Documentation ¶
Overview ¶
Package migrator is the manager of db migrations
Index ¶
Constants ¶
View Source
const ( // GormMode gorm mode GormMode string = "gorm" // SqlMode sql mode SqlMode string = "sql" )
Variables ¶
This section is empty.
Functions ¶
func GetDownSQLKey ¶
GetDownSQLKey get the up sql key for MigrationSQLs
func GetUpSQLKey ¶
GetUpSQLKey get the down sql key for MigrationSQLs
Types ¶
type Migration ¶
type Migration struct { Version string Name string Mode string Up func(*gorm.DB) error Down func(*gorm.DB) error // contains filtered or unexported fields }
Migration is one specific db migration
type Migrator ¶
type Migrator struct { Versions []string Migrations map[string]*Migration MigrationSQLs map[string]string // contains filtered or unexported fields }
Migrator is the controller for all migrations
func (*Migrator) AddMigration ¶
AddMigration add one migration to migrator
func (*Migrator) MigrationStatus ¶
MigrationStatus get the current migration status
Click to show internal directories.
Click to hide internal directories.