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

Method LookIndex

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

Source from the content-addressed store, hash-verified

78}
79
80func (schema *Schema) LookIndex(name string) *Index {
81 if schema != nil {
82 indexes := schema.ParseIndexes()
83 for _, index := range indexes {
84 if index.Name == name {
85 return index
86 }
87
88 for _, field := range index.Fields {
89 if field.Name == name {
90 return index
91 }
92 }
93 }
94 }
95
96 return nil
97}
98
99func parseFieldIndexes(field *Field) (indexes []Index, err error) {
100 for _, value := range strings.Split(field.Tag.Get("gorm"), ";") {

Callers 3

CreateIndexMethod · 0.80
DropIndexMethod · 0.80
HasIndexMethod · 0.80

Calls 1

ParseIndexesMethod · 0.95

Tested by

no test coverage detected