package migrator

Import Path
	gorm.io/gorm/migrator (on go.dev)

Dependency Relation
	imports 12 packages, and imported by 2 packages


Package-Level Type Names (total 7)
/* sort by: | */
BuildIndexOptionsInterface build index options interface ( BuildIndexOptionsInterface) BuildIndexOptions([]schema.IndexOption, *gorm.Statement) []interface{} Migrator gorm.io/driver/mysql.Migrator gorm.io/driver/postgres.Migrator
ColumnType column type implements ColumnType interface AutoIncrementValue sql.NullBool ColumnTypeValue sql.NullString CommentValue sql.NullString DataTypeValue sql.NullString DecimalSizeValue sql.NullInt64 DefaultValueValue sql.NullString LengthValue sql.NullInt64 NameValue sql.NullString NullableValue sql.NullBool PrimaryKeyValue sql.NullBool SQLColumnType *sql.ColumnType ScaleValue sql.NullInt64 ScanTypeValue reflect.Type UniqueValue sql.NullBool AutoIncrement returns the column is auto increment or not. ColumnType returns the database type of the column. like `varchar(16)` Comment returns the comment of current column. DatabaseTypeName returns the database system name of the column type. If an empty string is returned, then the driver type name is not supported. Consult your driver documentation for a list of driver data types. Length specifiers are not included. Common type names include "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL", "INT", and "BIGINT". DecimalSize returns the scale and precision of a decimal type. DefaultValue returns the default value of current column. Length returns the column type length for variable length column types Name returns the name or alias of the column. Nullable reports whether the column may be null. PrimaryKey returns the column is primary key or not. ScanType returns a Go type suitable for scanning into using Rows.Scan. Unique reports whether the column may be unique. ColumnType : gorm.io/gorm.ColumnType
Config schema config CreateIndexAfterCreateTable bool DB *gorm.DB Dialector gorm.Dialector ( Config) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{}) ( Config) DataTypeOf(*schema.Field) string ( Config) DefaultValueOf(*schema.Field) clause.Expression ( Config) Explain(sql string, vars ...interface{}) string ( Config) Initialize(*gorm.DB) error ( Config) Migrator(db *gorm.DB) gorm.Migrator ( Config) Name() string ( Config) QuoteTo(clause.Writer, string) Config : gorm.io/gorm.Dialector Config : gorm.io/gorm.Plugin
GormDataTypeInterface gorm data type interface ( GormDataTypeInterface) GormDBDataType(*gorm.DB, *schema.Field) string
Index implements gorm.Index interface ColumnList []string NameValue string OptionValue string PrimaryKeyValue sql.NullBool TableName string UniqueValue sql.NullBool Columns return the columns of the index Name return the name of the index. Option return the optional attribute of the index PrimaryKey returns the index is primary key or not. Table return the table name of the index. Unique returns whether the index is unique or not. Index : gorm.io/gorm.Index
Migrator m struct Config Config Config.CreateIndexAfterCreateTable bool Config.DB *gorm.DB Config.Dialector gorm.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
TableType table type implements TableType interface CommentValue sql.NullString NameValue string SchemaValue string TypeValue string Comment returns the comment of current table. Name returns the name of the table. Schema returns the schema of the table. Type returns the type of the table. TableType : gorm.io/gorm.TableType