Documentation ¶
Index ¶
- Constants
- type Column
- type Index
- type MigrateAction
- type Migration
- func (m *Migration) AddColumn(tbName string, col Column)
- 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) RemoveIndex(tbName string, 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 Table
- func (t *Table) AddColumn(col Column)
- 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) MigrationIndexDown(dropCols map[string]struct{}) []string
- func (t Table) MigrationIndexUp(dropCols map[string]struct{}) []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 Column ¶
type Column struct { Node Typ *types.FieldType PgTyp *ptypes.T Options []*ast.ColumnOption Comment string }
Column ...
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 // MigrateRenameAction ... MigrateRenameAction )
type Migration ¶
type Migration struct { Tables []Table // contains filtered or unexported fields }
Migration ...
func (*Migration) RemoveColumn ¶
RemoveColumn ...
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 // 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) MigrationIndexDown ¶
MigrationIndexDown ...
func (Table) MigrationIndexUp ¶
MigrationIndexUp ...
Click to show internal directories.
Click to hide internal directories.