GormDBDataType(*gorm.DB, *schema.Field) string
GormDataTypeInterface gorm data type interface
func (m Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []interface{})
BuildIndexOptions build index options
func (m Migrator) CreateView(name string, option gorm.ViewOption) error
CreateView create view from Query in gorm.ViewOption.
Query in gorm.ViewOption is a subquery
// CREATE VIEW `user_view` AS SELECT * FROM `users` WHERE age > 20
q := DB.Model(&User{}).Where("age > ?", 20)
DB.Debug().Migrator().CreateView("user_view", gorm.ViewOption{Query: q})
// CREATE OR REPLACE VIEW `users_view` AS SELECT * FROM `users` WITH CHECK OPTION
q := DB.Model(&User{})
DB.Debug().Migrator().CreateView("user_view", gorm.ViewOption{Query: q, Replace: true, CheckOption: "WITH CHECK OPTION"})
func (m Migrator) GuessConstraintAndTable(stmt *gorm.Statement, name string) (*schema.Constraint, *schema.CheckConstraint, string)
GuessConstraintAndTable guess statement's constraint and it's table based on name
Deprecated: use GuessConstraintInterfaceAndTable instead.
func (m Migrator) GuessConstraintInterfaceAndTable(stmt *gorm.Statement, name string) (_ schema.ConstraintInterface, table string)
GuessConstraintInterfaceAndTable guess statement's constraint and it's table based on name
nolint:cyclop
func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnType gorm.ColumnType) error
MigrateColumn migrate column
func (m Migrator) ReorderModels(values []interface{}, autoAdd bool) (results []interface{})
ReorderModels reorder models according to constraint dependencies
func (m Migrator) RunWithValue(value interface{}, fc func(*gorm.Statement) error) error
RunWithValue run migration with statement value
go.dev uses cookies from Google to deliver and enhance the quality of its services and to
analyze traffic.
Learn more.