Documentation ¶
Index ¶
- func Announce(ops Operations, db DB)
- func Init(op InitOption) error
- func JoinWithComma(list []string, prefix, suffix string) string
- func NewMigrateOptionInvalidError() error
- func NewMySQLConfig(db DB) mysql.Config
- func NewOptionEmptyError(op string) error
- func Plan(op MigrateOption) error
- func ReadSchema(op MigrateOption) (*hschema.HyperSchema, error)
- func Run(op MigrateOption) error
- func Seed(op SeedOption) error
- func Wait(op WaitOption) error
- type AddColumn
- type AddForeignKey
- type AddIndex
- type AddPrimaryKey
- type Column
- type Columns
- type ConnectionError
- type CreateTable
- type DB
- type DatabaseConfigure
- type DropColumn
- type DropForeignKey
- type DropIndex
- type DropPrimaryKey
- type DropTable
- type ForeignKey
- type ForeignKeys
- type InitOption
- type Key
- type Keys
- type Logger
- type MigrateOption
- type MigrateOptionInvalidError
- type Operation
- func NewAddColumn(t Table, c Column) Operation
- func NewAddForeignKey(key ForeignKey) Operation
- func NewCreateTable(t Table) Operation
- func NewDropColumn(t Table, c Column) Operation
- func NewDropForeignKey(key ForeignKey) Operation
- func NewDropTable(t Table) Operation
- func NewRenameTable(old, new Table) Operation
- func NewUpdateColumn(t Table, old, new Column) Operation
- type Operations
- type OptionEmptyError
- type Records
- type RenameTable
- type SeedOption
- type State
- type Table
- type Tables
- type UpdateColumn
- type WaitOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Announce ¶
func Announce(ops Operations, db DB)
func Init ¶
func Init(op InitOption) error
func JoinWithComma ¶
func NewMigrateOptionInvalidError ¶
func NewMigrateOptionInvalidError() error
func NewMySQLConfig ¶
func NewOptionEmptyError ¶
func Plan ¶
func Plan(op MigrateOption) error
func ReadSchema ¶
func ReadSchema(op MigrateOption) (*hschema.HyperSchema, error)
func Run ¶
func Run(op MigrateOption) error
func Seed ¶
func Seed(op SeedOption) error
func Wait ¶
func Wait(op WaitOption) error
Types ¶
type AddForeignKey ¶
type AddForeignKey struct {
ForeignKey ForeignKey
}
func (AddForeignKey) Query ¶
func (op AddForeignKey) Query() string
func (AddForeignKey) RollBack ¶
func (op AddForeignKey) RollBack() string
func (AddForeignKey) String ¶
func (op AddForeignKey) String() string
type AddIndex ¶
func NewAddIndex ¶
type AddPrimaryKey ¶
func NewAddPrimaryKey ¶
func NewAddPrimaryKey(t Table, k Key) AddPrimaryKey
func (AddPrimaryKey) Query ¶
func (op AddPrimaryKey) Query() string
func (AddPrimaryKey) RollBack ¶
func (op AddPrimaryKey) RollBack() string
func (AddPrimaryKey) String ¶
func (op AddPrimaryKey) String() string
type Column ¶
type ConnectionError ¶
type ConnectionError struct {
// contains filtered or unexported fields
}
func NewConnectionError ¶
func NewConnectionError(err error) ConnectionError
func (ConnectionError) Error ¶
func (err ConnectionError) Error() string
type CreateTable ¶
type CreateTable struct {
Table Table
}
func (CreateTable) Query ¶
func (op CreateTable) Query() string
func (CreateTable) RollBack ¶
func (op CreateTable) RollBack() string
func (CreateTable) String ¶
func (op CreateTable) String() string
type DB ¶
type DB struct { User string `json:"user"` Passwd string `json:"passwd"` Addr string `json:"addr"` DBName string `json:"dbname"` }
func (DB) FormatDBUnspecifiedDSN ¶
type DatabaseConfigure ¶
func NewDatabaseConfigure ¶
func NewDatabaseConfigure(filePath string) (DatabaseConfigure, error)
type DropColumn ¶
func (DropColumn) Query ¶
func (op DropColumn) Query() string
func (DropColumn) RollBack ¶
func (op DropColumn) RollBack() string
func (DropColumn) String ¶
func (op DropColumn) String() string
type DropForeignKey ¶
type DropForeignKey struct {
ForeignKey ForeignKey
}
func (DropForeignKey) Query ¶
func (op DropForeignKey) Query() string
func (DropForeignKey) RollBack ¶
func (op DropForeignKey) RollBack() string
func (DropForeignKey) String ¶
func (op DropForeignKey) String() string
type DropIndex ¶
func NewDropIndex ¶
type DropPrimaryKey ¶
func NewDropPrimaryKey ¶
func NewDropPrimaryKey(t Table, k Key) DropPrimaryKey
func (DropPrimaryKey) Query ¶
func (op DropPrimaryKey) Query() string
func (DropPrimaryKey) RollBack ¶
func (op DropPrimaryKey) RollBack() string
func (DropPrimaryKey) String ¶
func (op DropPrimaryKey) String() string
type ForeignKey ¶
type ForeignKey struct { Name string `json:"name"` SourceTable Table `json:"source_table"` SourceColumn Column `json:"source_column"` TargetTable Table `json:"target_table"` TargetColumn Column `json:"column"` UpdateCascade bool `json:"update_cascade"` DeleteCascade bool `json:"delete_cascade"` Raw map[string]interface{} `json:"-"` }
func NewForeignKey ¶
func NewForeignKey(sourceTable Table, sourceColumn Column) ForeignKey
type ForeignKeys ¶
type ForeignKeys []ForeignKey
func (ForeignKeys) Len ¶
func (k ForeignKeys) Len() int
func (ForeignKeys) Less ¶
func (k ForeignKeys) Less(i, j int) bool
func (ForeignKeys) Swap ¶
func (k ForeignKeys) Swap(i, j int)
type InitOption ¶
func NewInitOption ¶
func NewInitOption(c *cli.Context) (InitOption, error)
type MigrateOption ¶
type MigrateOption struct { FormatType string ConfigFile string StateFile string SchemaFile string Environment string }
func NewMigrateOption ¶
func NewMigrateOption(c *cli.Context) (MigrateOption, error)
func (*MigrateOption) SetConfigFile ¶
func (op *MigrateOption) SetConfigFile(config string) error
func (*MigrateOption) SetEnvironment ¶
func (op *MigrateOption) SetEnvironment(env string) error
func (*MigrateOption) SetJSONFormatSchema ¶
func (op *MigrateOption) SetJSONFormatSchema(schema string)
func (*MigrateOption) SetStateFile ¶
func (op *MigrateOption) SetStateFile(state string) error
func (*MigrateOption) SetYAMLFormatSchema ¶
func (op *MigrateOption) SetYAMLFormatSchema(schema string)
type MigrateOptionInvalidError ¶
type MigrateOptionInvalidError struct { }
func (MigrateOptionInvalidError) Error ¶
func (err MigrateOptionInvalidError) Error() string
type Operation ¶
func NewAddColumn ¶
func NewAddForeignKey ¶
func NewAddForeignKey(key ForeignKey) Operation
func NewCreateTable ¶
func NewDropColumn ¶
func NewDropForeignKey ¶
func NewDropForeignKey(key ForeignKey) Operation
func NewDropTable ¶
func NewRenameTable ¶
func NewUpdateColumn ¶
type Operations ¶
type Operations struct { Operation []Operation // contains filtered or unexported fields }
func NewOperations ¶
func NewOperations(currentState, newState State) (Operations, error)
func (*Operations) CreateTables ¶
func (ops *Operations) CreateTables(ts []Table) error
func (*Operations) DropTables ¶
func (ops *Operations) DropTables(ts []Table) error
func (*Operations) UpdateTable ¶
func (ops *Operations) UpdateTable(currentTable, newTable Table) error
type OptionEmptyError ¶
type OptionEmptyError struct {
Option string
}
func (OptionEmptyError) Error ¶
func (err OptionEmptyError) Error() string
type Records ¶
func NewRecords ¶
type RenameTable ¶
func (RenameTable) Query ¶
func (op RenameTable) Query() string
func (RenameTable) RollBack ¶
func (op RenameTable) RollBack() string
func (RenameTable) String ¶
func (op RenameTable) String() string
type SeedOption ¶
func NewSeedOption ¶
func NewSeedOption(c *cli.Context) (SeedOption, error)
type State ¶
type State struct { DB DB `json:"db"` Tables Tables `json:"tables"` ForeignKey ForeignKeys `json:"foreign_key"` UpdatedAt time.Time `json:"updated_at"` }
func NewStateFromSchema ¶
func NewStateFromYAML ¶
type Table ¶
type UpdateColumn ¶
func (UpdateColumn) Query ¶
func (op UpdateColumn) Query() string
func (UpdateColumn) RollBack ¶
func (op UpdateColumn) RollBack() string
func (UpdateColumn) String ¶
func (op UpdateColumn) String() string
type WaitOption ¶
func NewWaitOption ¶
func NewWaitOption(c *cli.Context) (WaitOption, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.