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

Method BuildIndexOptions

migrator/migrator.go:808–827  ·  view source on GitHub ↗

BuildIndexOptions build index options

(opts []schema.IndexOption, stmt *gorm.Statement)

Source from the content-addressed store, hash-verified

806
807// BuildIndexOptions build index options
808func (m Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []interface{}) {
809 for _, opt := range opts {
810 str := stmt.Quote(opt.DBName)
811 if opt.Expression != "" {
812 str = opt.Expression
813 } else if opt.Length > 0 {
814 str += fmt.Sprintf("(%d)", opt.Length)
815 }
816
817 if opt.Collate != "" {
818 str += " COLLATE " + opt.Collate
819 }
820
821 if opt.Sort != "" {
822 str += " " + opt.Sort
823 }
824 results = append(results, clause.Expr{SQL: str})
825 }
826 return
827}
828
829// BuildIndexOptionsInterface build index options interface
830type BuildIndexOptionsInterface interface {

Callers

nothing calls this directly

Implementers 1

Migratormigrator/migrator.go

Calls 1

QuoteMethod · 0.80

Tested by

no test coverage detected