Documentation
¶
Index ¶
- type MigrateType
- type MigrationManger
- func (mm *MigrationManger) Change(up, down changeFunc) error
- func (mm *MigrationManger) ChangeColumn(dst interface{}, column string) error
- func (mm *MigrationManger) ChangeFuncWrap(sqlLines ...string) changeFunc
- func (mm *MigrationManger) ChangeTable(dst interface{}) error
- func (mm *MigrationManger) IsCompleted() bool
- func (mm *MigrationManger) Migrate()
- func (mm *MigrationManger) RegisterFunctions(changeFunctions ...changeFunc) *MigrationManger
- type SchemaMigration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MigrateType ¶
type MigrateType int8
const ( Check MigrateType = iota Migrate Rollback )
func (*MigrateType) Set ¶
func (t *MigrateType) Set(value string) error
Set for flag parse implement: type Value interface
func (*MigrateType) String ¶
func (t *MigrateType) String() string
String for flag parse implement: type Value interface
type MigrationManger ¶ added in v0.0.2
type MigrationManger struct { DB *gorm.DB Type MigrateType Columns []*SchemaMigration // saved in database Migrations []*SchemaMigration // registered by code }
func NewMigrationManger ¶
func NewMigrationManger(db *gorm.DB, t MigrateType) *MigrationManger
func (*MigrationManger) Change ¶ added in v0.0.2
func (mm *MigrationManger) Change(up, down changeFunc) error
Change migrate up or migrate down
func (*MigrationManger) ChangeColumn ¶ added in v0.0.2
func (mm *MigrationManger) ChangeColumn(dst interface{}, column string) error
ChangeColumn create or drop table
func (*MigrationManger) ChangeFuncWrap ¶ added in v0.0.2
func (mm *MigrationManger) ChangeFuncWrap(sqlLines ...string) changeFunc
func (*MigrationManger) ChangeTable ¶ added in v0.0.2
func (mm *MigrationManger) ChangeTable(dst interface{}) error
ChangeTable create or drop table
func (*MigrationManger) IsCompleted ¶ added in v0.0.2
func (mm *MigrationManger) IsCompleted() bool
IsCompleted fill mm Columns, and check Columns match with Migrations
func (*MigrationManger) Migrate ¶ added in v0.0.2
func (mm *MigrationManger) Migrate()
Migrate trigger
func (*MigrationManger) RegisterFunctions ¶ added in v0.0.2
func (mm *MigrationManger) RegisterFunctions(changeFunctions ...changeFunc) *MigrationManger
RegisterFunctions fill it by user
type SchemaMigration ¶
type SchemaMigration struct { gorm.Model FuncName string // contains filtered or unexported fields }
save to database
Click to show internal directories.
Click to hide internal directories.