Migrator m structConfigConfigConfig.CreateIndexAfterCreateTableboolConfig.DB*gorm.DBConfig.Dialectorgorm.Dialector AddColumn create `name` column for value AlterColumn alter value's `field` column' type based on schema definition AutoMigrate auto migrate values( Migrator) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{}) BuildIndexOptions build index options ColumnTypes return columnTypes []gorm.ColumnType and execErr error CreateConstraint create constraint CreateIndex create index `name` CreateTable create table in database for values 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"})
[subquery]: https://gorm.io/docs/advanced_query.html#SubQuery CurrentDatabase returns current database name CurrentTable returns current statement's table expression DataTypeOf return field's db data type( Migrator) DefaultValueOf(*schema.Field) clause.Expression DropColumn drop value's `name` column DropConstraint drop constraint DropIndex drop index `name` DropTable drop table for values DropView drop view( Migrator) Explain(sql string, vars ...interface{}) string FullDataTypeOf returns field's db full data type GetIndexes return Indexes []gorm.Index and execErr error GetTables returns tables GetTypeAliases return database type aliases GuessConstraintAndTable guess statement's constraint and it's table based on name HasColumn check has column `field` for value or not HasConstraint check has constraint or not HasIndex check has index `name` or not HasTable returns table exists or not for value, value could be a struct or string( Migrator) Initialize(*gorm.DB) error MigrateColumn migrate column( Migrator) Migrator(db *gorm.DB) gorm.Migrator( Migrator) Name() string( Migrator) QuoteTo(clause.Writer, string) RenameColumn rename value's field name from oldName to newName RenameIndex rename index from oldName to newName RenameTable rename table from oldName to newName ReorderModels reorder models according to constraint dependencies RunWithValue run migration with statement value TableType return tableType gorm.TableType and execErr error
Migrator : BuildIndexOptionsInterface
Migrator : gorm.io/gorm.Dialector
Migrator : gorm.io/gorm.Migrator
Migrator : gorm.io/gorm.Plugin
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.