Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

utils

v1.31.2
gorm.io/gorm/utils

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

13 matches

Top ↑

Package utils provides internal utility functions for GORM.

Functions

AssertEqual

func AssertEqual(x, y interface{}) bool

CallerFrame

func CallerFrame() runtime.Frame

CallerFrame retrieves the first relevant stack frame outside of GORM's internal implementation files. It skips:

  • GORM's core source files (identified by gormSourceDir prefix)
  • Exclude test files (*_test.go)
  • go-gorm/gen's Generated files (*.gen.go)

CheckTruth

func CheckTruth(vals ...string) bool

CheckTruth check string true or not

Contains

func Contains(elems []string, elem string) bool

FileWithLineNum

func FileWithLineNum() string

FileWithLineNum return the file name and line number of the current file

IsInvalidDBNameChar

func IsInvalidDBNameChar(c rune) bool

JoinNestedRelationNames

func JoinNestedRelationNames(relationNames []string) string

JoinNestedRelationNames nested relationships like `Manager__Company`

NestedRelationName

func NestedRelationName(prefix, name string) string

NestedRelationName nested relationships like `Manager__Company`

RTrimSlice

func RTrimSlice[T any](v []T, trimLen int) []T

RTrimSlice Right trims the given slice by given length

SplitNestedRelationName

func SplitNestedRelationName(name string) []string

SplitNestedRelationName Split nested relationships to `[]string{"Manager","Company"}`

ToString

func ToString(value interface{}) string

ToStringKey

func ToStringKey(values ...interface{}) string

Dependency graph