package postgres
Import Path
gorm.io/driver/postgres (on go.dev )
Dependency Relation
imports 15 packages , and imported by one package
Package-Level Type Names (total 5)
/* sort by: alphabet | popularity */
type Migrator (struct)
Fields (total 5 )
Migrator migrator .Migrator
Migrator .Config migrator .Config
Migrator .Config .CreateIndexAfterCreateTable bool
Migrator .Config .DB *gorm .DB
Migrator .Config .Dialector gorm .Dialector
Methods (total 44 )
( Migrator) AddColumn (value interface{}, field string ) error
( Migrator) AlterColumn (value interface{}, field string ) error
AlterColumn alter value's `field` column' type based on schema definition
( Migrator) AutoMigrate (values ...interface{}) error
AutoMigrate auto migrate values
( Migrator) BindVarTo (writer clause .Writer , stmt *gorm .Statement , v interface{})
( Migrator) BuildIndexOptions (opts []schema .IndexOption , stmt *gorm .Statement ) (results []interface{})
( Migrator) ColumnTypes (value interface{}) (columnTypes []gorm .ColumnType , err error )
( Migrator) CreateConstraint (value interface{}, name string ) error
CreateConstraint create constraint
( Migrator) CreateIndex (value interface{}, name string ) error
( Migrator) CreateSequence (tx *gorm .DB , stmt *gorm .Statement , field *schema .Field , serialDatabaseType string ) (err error )
( Migrator) CreateTable (values ...interface{}) (err error )
( 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"})
[subquery]: https://gorm.io/docs/advanced_query.html#SubQuery
( Migrator) CurrentDatabase () (name string )
( Migrator) CurrentSchema (stmt *gorm .Statement , table string ) (interface{}, interface{})
( Migrator) CurrentTable (stmt *gorm .Statement ) interface{}
CurrentTable returns current statement's table expression
( Migrator) DataTypeOf (field *schema .Field ) string
DataTypeOf return field's db data type
( Migrator) DefaultValueOf (*schema .Field ) clause .Expression
( Migrator) DeleteSequence (tx *gorm .DB , stmt *gorm .Statement , field *schema .Field , fileType clause .Expr ) (err error )
( Migrator) DropColumn (dst interface{}, field string ) error
( Migrator) DropConstraint (value interface{}, name string ) error
DropConstraint drop constraint
( Migrator) DropIndex (value interface{}, name string ) error
( Migrator) DropTable (values ...interface{}) error
( Migrator) DropView (name string ) error
DropView drop view
( Migrator) Explain (sql string , vars ...interface{}) string
( Migrator) FullDataTypeOf (field *schema .Field ) (expr clause .Expr )
FullDataTypeOf returns field's db full data type
( Migrator) GetIndexes (value interface{}) ([]gorm .Index , error )
( Migrator) GetRows (currentSchema interface{}, table interface{}) (*sql .Rows , error )
( Migrator) GetTables () (tableList []string , err error )
( Migrator) GetTypeAliases (databaseTypeName string ) []string
( Migrator) GuessConstraintAndTable (stmt *gorm .Statement , name string ) (_ *schema .Constraint , _ *schema .Check , table string )
GuessConstraintAndTable guess statement's constraint and it's table based on name
( Migrator) HasColumn (value interface{}, field string ) bool
( Migrator) HasConstraint (value interface{}, name string ) bool
( Migrator) HasIndex (value interface{}, name string ) bool
( Migrator) HasTable (value interface{}) bool
( Migrator) Initialize (*gorm .DB ) error
( Migrator) MigrateColumn (value interface{}, field *schema .Field , columnType gorm .ColumnType ) error
( Migrator) Name () string
( Migrator) QuoteTo (clause .Writer , string )
( Migrator) RenameColumn (dst interface{}, oldName, field string ) error
( Migrator) RenameIndex (value interface{}, oldName, newName string ) error
( Migrator) RenameTable (oldName, newName interface{}) error
RenameTable rename table from oldName to newName
( Migrator) ReorderModels (values []interface{}, autoAdd bool ) (results []interface{})
ReorderModels reorder models according to constraint dependencies
( Migrator) RunWithValue (value interface{}, fc func(*gorm .Statement ) error ) error
RunWithValue run migration with statement value
( Migrator) TableType (dst interface{}) (gorm .TableType , error )
TableType return tableType gorm.TableType and execErr error
( Migrator) UpdateSequence (tx *gorm .DB , stmt *gorm .Statement , field *schema .Field , serialDatabaseType string ) (err error )
Implements (at least 3 )
Migrator : gorm.io/gorm.Migrator
Migrator : gorm.io/gorm.Plugin
Migrator : gorm.io/gorm/migrator.BuildIndexOptionsInterface
Package-Level Functions (total 2)
The pages are generated with Golds v0.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 .