Documentation ¶
Index ¶
- Constants
- type Column
- type ForeignKey
- type Index
- type MigrateAction
- type Migration
- func (m *Migration) AddColumn(tbName string, col Column)
- func (m *Migration) AddComment(tbName, colName, comment string)
- func (m *Migration) AddForeignKey(tbName string, fk ForeignKey)
- func (m *Migration) AddIndex(tbName string, idx Index)
- func (m *Migration) AddTable(tb Table)
- func (m *Migration) Diff(old Migration)
- func (m Migration) HashValue() int64
- func (m Migration) MigrationDown() string
- func (m Migration) MigrationUp() string
- func (m *Migration) RemoveColumn(tbName, colName string)
- func (m *Migration) RemoveForeignKey(tbName, fkName string)
- func (m *Migration) RemoveIndex(tbName, idxName string)
- func (m *Migration) RemoveTable(tbName string)
- func (m *Migration) RenameColumn(tbName, oldName, newName string)
- func (m *Migration) RenameIndex(tbName, oldName, newName string)
- func (m *Migration) RenameTable(oldName, newName string)
- func (m *Migration) SetColumnPosition(tbName string, pos *ast.ColumnPosition)
- func (m *Migration) Using(tbName string)
- type Node
- type SqlAttr
- type Table
- func (t *Table) AddColumn(col Column)
- func (t *Table) AddForeignKey(fk ForeignKey)
- func (t *Table) AddIndex(idx Index)
- func (t *Table) Arrange()
- func (t *Table) Diff(old Table)
- func (t Table) MigrationColumnDown() ([]string, map[string]struct{})
- func (t Table) MigrationColumnUp() ([]string, map[string]struct{})
- func (t Table) MigrationForeignKeyDown(dropCols map[string]struct{}) []string
- func (t Table) MigrationForeignKeyUp(dropCols map[string]struct{}) []string
- func (t Table) MigrationIndexDown(dropCols map[string]struct{}) []string
- func (t Table) MigrationIndexUp(dropCols map[string]struct{}) []string
- func (t *Table) RemoveForeignKey(fkName string)
- func (t *Table) RemoveIndex(idxName string)
- func (t *Table) RenameColumn(oldName, newName string)
- func (t *Table) RenameIndex(oldName, newName string)
Constants ¶
View Source
const ( // UppercaseRestoreFlag ... UppercaseRestoreFlag = format.RestoreStringSingleQuotes | format.RestoreKeyWordUppercase | format.RestoreNameUppercase | format.RestoreNameBackQuotes // LowerRestoreFlag ... LowerRestoreFlag = format.RestoreStringSingleQuotes | format.RestoreKeyWordLowercase | format.RestoreNameLowercase | format.RestoreNameBackQuotes )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ForeignKey ¶
type ForeignKey struct { Node Table string Column string RefTable string RefColumn string Constraint string }
ForeignKey ...
type Index ¶
type Index struct { Node Typ ast.IndexKeyType IndexType model.IndexType CnsTyp ast.ConstraintType Columns []string }
Index ...
type MigrateAction ¶
type MigrateAction int8
MigrateAction ...
const ( // MigrateNoAction ... MigrateNoAction MigrateAction = iota // MigrateAddAction ... MigrateAddAction // MigrateRemoveAction ... MigrateRemoveAction // MigrateModifyAction ... MigrateModifyAction // MigrateRevertAction ... MigrateRevertAction // MigrateRenameAction ... MigrateRenameAction )
type Migration ¶
type Migration struct { Tables []Table // contains filtered or unexported fields }
Migration ...
func NewMigration ¶
func NewMigration(dialect sql_templates.SqlDialect, lowercase, ignoreOrder bool) Migration
NewMigration ...
func (*Migration) AddComment ¶
AddIndex ...
func (*Migration) AddForeignKey ¶
func (m *Migration) AddForeignKey(tbName string, fk ForeignKey)
AddForeignKey ...
func (*Migration) RemoveColumn ¶
RemoveColumn ...
func (*Migration) RemoveForeignKey ¶
RemoveForeignKey ...
func (*Migration) RemoveIndex ¶
RemoveIndex ...
func (*Migration) RenameColumn ¶
RenameColumn ...
func (*Migration) RenameIndex ¶
RenameIndex ...
func (*Migration) RenameTable ¶
RenameTable ...
func (*Migration) SetColumnPosition ¶
func (m *Migration) SetColumnPosition(tbName string, pos *ast.ColumnPosition)
SetColumnPosition ...
type Node ¶
type Node struct { Name string OldName string Action MigrateAction }
Node primitive element
type Table ¶
type Table struct { Node Columns []Column Indexes []Index ForeignKeys []ForeignKey // contains filtered or unexported fields }
Table ...
func NewTableWithAction ¶
func NewTableWithAction(name string, action MigrateAction) *Table
NewTableWithAction ...
func (Table) MigrationColumnDown ¶
MigrationColumnDown ...
func (Table) MigrationColumnUp ¶
MigrationColumnUp ...
func (Table) MigrationForeignKeyDown ¶
MigrationForeignKeyDown ...
func (Table) MigrationForeignKeyUp ¶
MigrationForeignKeyUp ...
func (Table) MigrationIndexDown ¶
MigrationIndexDown ...
func (Table) MigrationIndexUp ¶
MigrationIndexUp ...
func (*Table) RemoveForeignKey ¶
RemoveForeignKey ...
Source Files ¶
Click to show internal directories.
Click to hide internal directories.