MCPcopy
hub / github.com/go-gorm/gorm / LookUpField

Method LookUpField

schema/schema.go:79–97  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

77}
78
79func (schema *Schema) LookUpField(name string) *Field {
80 if field, ok := schema.FieldsByDBName[name]; ok {
81 return field
82 }
83 if field, ok := schema.FieldsByName[name]; ok {
84 return field
85 }
86
87 // Lookup field using namer-driven ColumnName
88 if schema.namer == nil {
89 return nil
90 }
91 namerColumnName := schema.namer.ColumnName(schema.Table, name)
92 if field, ok := schema.FieldsByDBName[namerColumnName]; ok {
93 return field
94 }
95
96 return nil
97}
98
99// LookUpFieldByBindName looks for the closest field in the embedded struct.
100//

Callers 15

prepareValuesFunction · 0.80
ScanFunction · 0.80
SetColumnMethod · 0.80
ChangedMethod · 0.80
SelectAndOmitColumnsMethod · 0.80
SetupJoinTableMethod · 0.80
CountMethod · 0.80
PluckMethod · 0.80

Calls 1

ColumnNameMethod · 0.65