Documentation ¶
Index ¶
- Constants
- func DbClose(db interface{})
- func DbExec(db interface{}, stmt string, args ...interface{}) error
- func DbPing(db interface{}) error
- func HelperTypeExists(t *Type, localTypes []Type) bool
- func Merge(mrg *StmtCtx, tableCtx *MergeTableCtx, typeCtx *MergeTypeCtx) (string, error)
- func MergeAddOperation(dest *string, elem string)
- func MergeCheck(mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx)
- func MergeColumns(rem *StmtCtx, localTable *Table, remTable *Table, ts *MergeTableCtx, ...)
- func MergeCompareCColumn(c1 []ConstraintColumn, c2 []ConstraintColumn) bool
- func MergeCompareColumn(m *StmtCtx, c1 *Column, c2 *Column) bool
- func MergeComposite(r *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx, lt *Type, rt *Type)
- func MergeDropRecreate(m *StmtCtx, dc []MergeDropCtx, ss *MergeScriptCtx, ts *MergeTableCtx)
- func MergeDropRecreateColRefs(m *StmtCtx, tables []Table, create *string, dc []MergeDropCtx)
- func MergeDropRecreatePkRefs(m *StmtCtx, tables []Table, create *string, dc []MergeDropCtx)
- func MergeEnum(r *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx, lt *Type, rt *Type)
- func MergeFK(mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx)
- func MergeIx(mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx)
- func MergePrimary(mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx, ...)
- func MergeTables(ctx *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx)
- func MergeType(r *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx, lt *Type, rt *Type)
- func MergeTypes(m *StmtCtx, tt *MergeTypeCtx, ts *MergeTableCtx, ss *MergeScriptCtx)
- func MergeUnique(mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx)
- func ParserElevateErrorType(tname string, err error) error
- func ParserGetValidateObject(path string, fc []byte, args interface{}) error
- func ParserIsDirectory(path string) (bool, error)
- func ParserValidateCColumn(c []ConstraintColumn) error
- func ParserValidateCheck(checks []Check) error
- func ParserValidateColumn(ctx *StmtCtx, c []Column) error
- func ParserValidateConstraint(c Constraint) error
- func ParserValidateFK(fks []ForeignKey) error
- func ParserValidateIndex(ixs []Index) error
- func ParserValidatePK(pk *PrimaryKey) error
- func ParserValidateTable(ctx *StmtCtx, t *Table, f string) error
- func ParserValidateType(ctx *StmtCtx, t *Type, path string) error
- func ParserValidateUnique(us []Unique) error
- func RemoteGetTypedTableInfo(db *sql.DB, t *Table) error
- func StmtAddCheck(tableName string, c *Check) string
- func StmtAddColumn(tableName string, c *Column) string
- func StmtAddConstraint(tableName string, c *Constraint, cType string) string
- func StmtAddFk(tableName string, fk *ForeignKey) string
- func StmtAddIndex(tableName string, ix *Index) string
- func StmtAddPK(tableName string, pk *PrimaryKey) string
- func StmtAddType(t *Type) string
- func StmtAddUnique(tableName string, u *Unique) string
- func StmtAlterColumn(tableName string, sc, c *Column) string
- func StmtColumnNameAndType(column *Column) string
- func StmtColumnType(column *Column) string
- func StmtConstraintColumn(c ConstraintColumn) string
- func StmtCreateTable(t *Table) string
- func StmtDropColumn(tablename string, c *Column) string
- func StmtDropConstraint(tableName string, c *Constraint) string
- func StmtDropIndex(tableName string, i *Index) string
- func StmtDropTable(table *Table) string
- func StmtDropType(t *Type) string
- func TargetCtxNew() *target.Ctx
- func TargetGetCS(target *target.Target) (string, error)
- func TargetGetDB(target *target.Target) (interface{}, error)
- func TargetGetMergeScript(c *target.Config, dbCtx interface{}, ectx *target.Target, args []string) (string, error)
- type Check
- type Column
- type Constraint
- type ConstraintColumn
- type DDObject
- type ForeignKey
- type Index
- type IndexColumn
- type MergeDropCtx
- func MergeDropColRefs(m *StmtCtx, col *Column, table *Table, tables []Table, drop *string) []MergeDropCtx
- func MergeDropCompositeTypeColumnRefs(r *StmtCtx, lt *Type, ts *MergeTableCtx, ss *MergeScriptCtx, c *Column) []MergeDropCtx
- func MergeDropNewC(tablename string, c *Column) MergeDropCtx
- func MergeDropNewFK(tableName string, fk *ForeignKey) MergeDropCtx
- func MergeDropNewPK(tableName string, pk *PrimaryKey) MergeDropCtx
- func MergeDropNewUnique(tablename string, u *Unique) MergeDropCtx
- func MergeDropPkRefs(m *StmtCtx, tableName string, tables []Table, drop *string) []MergeDropCtx
- func MergeDropTypeRefs(m *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx, lt *Type) []MergeDropCtx
- type MergeScriptCtx
- type MergeTableCtx
- type MergeTypeCtx
- type ParseCtx
- type PrimaryKey
- type StmtCtx
- type Table
- type Type
- type Unique
Constants ¶
View Source
const ( DC_TYPE_PK = iota DC_TYPE_FK = iota DC_TYPE_UQ = iota DC_TYPE_CH = iota DC_TYPE_C = iota )
View Source
const ( TypeEnum string = "enum" TypeComposite string = "composite" )
Variables ¶
This section is empty.
Functions ¶
func HelperTypeExists ¶
func Merge ¶
func Merge( mrg *StmtCtx, tableCtx *MergeTableCtx, typeCtx *MergeTypeCtx) (string, error)
merge remote schema with local
func MergeAddOperation ¶ added in v1.0.0
func MergeCheck ¶ added in v1.0.0
func MergeCheck( mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx)
func MergeColumns ¶ added in v1.0.0
func MergeColumns( rem *StmtCtx, localTable *Table, remTable *Table, ts *MergeTableCtx, ss *MergeScriptCtx)
func MergeCompareCColumn ¶ added in v1.0.0
func MergeCompareCColumn(c1 []ConstraintColumn, c2 []ConstraintColumn) bool
func MergeCompareColumn ¶ added in v1.0.0
func MergeComposite ¶
func MergeComposite( r *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx, lt *Type, rt *Type)
func MergeDropRecreate ¶ added in v1.0.0
func MergeDropRecreate( m *StmtCtx, dc []MergeDropCtx, ss *MergeScriptCtx, ts *MergeTableCtx)
func MergeDropRecreateColRefs ¶ added in v1.0.0
func MergeDropRecreateColRefs( m *StmtCtx, tables []Table, create *string, dc []MergeDropCtx)
Obsolete : this method will be removed
func MergeDropRecreatePkRefs ¶ added in v1.0.0
func MergeDropRecreatePkRefs( m *StmtCtx, tables []Table, create *string, dc []MergeDropCtx)
func MergeEnum ¶
func MergeEnum( r *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx, lt *Type, rt *Type)
func MergeFK ¶ added in v1.0.0
func MergeFK( mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx)
func MergeIx ¶ added in v1.0.0
func MergeIx( mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx)
func MergePrimary ¶ added in v1.0.0
func MergePrimary( mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx, ts *MergeTableCtx)
func MergeTables ¶
func MergeTables(ctx *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx)
func MergeType ¶
func MergeType( r *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx, lt *Type, rt *Type)
func MergeTypes ¶
func MergeTypes( m *StmtCtx, tt *MergeTypeCtx, ts *MergeTableCtx, ss *MergeScriptCtx)
func MergeUnique ¶ added in v1.0.0
func MergeUnique( mrg *StmtCtx, localTable *Table, remTable *Table, ss *MergeScriptCtx)
func ParserElevateErrorType ¶
func ParserGetValidateObject ¶
func ParserIsDirectory ¶ added in v1.0.0
func ParserValidateCColumn ¶ added in v1.0.0
func ParserValidateCColumn(c []ConstraintColumn) error
func ParserValidateCheck ¶ added in v1.0.0
func ParserValidateColumn ¶ added in v1.0.0
func ParserValidateConstraint ¶ added in v1.0.0
func ParserValidateConstraint(c Constraint) error
func ParserValidateFK ¶ added in v1.0.0
func ParserValidateFK(fks []ForeignKey) error
func ParserValidateIndex ¶ added in v1.0.0
func ParserValidatePK ¶ added in v1.0.0
func ParserValidatePK(pk *PrimaryKey) error
func ParserValidateTable ¶ added in v1.0.0
func ParserValidateUnique ¶ added in v1.0.0
func StmtAddCheck ¶ added in v1.0.0
func StmtAddColumn ¶
func StmtAddConstraint ¶ added in v1.0.0
func StmtAddConstraint(tableName string, c *Constraint, cType string) string
func StmtAddFk ¶ added in v1.0.0
func StmtAddFk(tableName string, fk *ForeignKey) string
func StmtAddIndex ¶
func StmtAddPK ¶ added in v1.0.0
func StmtAddPK(tableName string, pk *PrimaryKey) string
func StmtAddType ¶
func StmtAddUnique ¶ added in v1.0.0
func StmtAlterColumn ¶
func StmtColumnNameAndType ¶ added in v1.0.0
func StmtColumnType ¶
func StmtConstraintColumn ¶ added in v1.0.0
func StmtConstraintColumn(c ConstraintColumn) string
func StmtCreateTable ¶
func StmtDropColumn ¶
func StmtDropConstraint ¶ added in v1.0.0
func StmtDropConstraint(tableName string, c *Constraint) string
func StmtDropIndex ¶
func StmtDropTable ¶ added in v1.0.0
func StmtDropType ¶
func TargetCtxNew ¶
func TargetGetDB ¶
Types ¶
type Column ¶ added in v1.0.0
type Column struct { Name string /* user should realize that specifying FullType instead of time does not require specifying Precision, Scale and type fields which may seem to be easier but becuase many rdbs use aliases for type ( user inputs `INT` but pgsql will output this as `INTEGER` ) user must be very cautious whilst doing it. however user type is supported anyways because of situations in which we cant get full column architecture but only string representation */ Type string FullType string Length int Precision int Scale int Nullable bool Identity bool Default string /* special value used during converting column types if specified then during type conversion this will be used */ HintUsing string `yaml:"using"` Tags map[string]struct{} }
type Constraint ¶ added in v1.0.0
type Constraint struct { Name string Columns []ConstraintColumn }
type ConstraintColumn ¶ added in v1.0.0
func HelperMapCColumns ¶ added in v1.0.0
func HelperMapCColumns(r *sql.Rows) ([]ConstraintColumn, error)
type ForeignKey ¶ added in v1.0.0
type ForeignKey struct { Ref_columns []ConstraintColumn Ref_table string Constraint `yaml:",inline"` OnDelete string `yaml:"on_delete"` OnUpdate string `yaml:"on_update"` }
func RemoteGetAllFK ¶
func RemoteGetAllFK(db *sql.DB, tableName string) ([]ForeignKey, error)
type Index ¶ added in v1.0.0
type Index struct { Name string Is_clustered bool //Is_unique bool Columns []IndexColumn Using string }
type IndexColumn ¶ added in v1.0.0
func HelperMapIxColumns ¶ added in v1.0.0
func HelperMapIxColumns(rows *sql.Rows) ([]IndexColumn, error)
type MergeDropCtx ¶ added in v1.0.0
type MergeDropCtx struct { Table string Type uint Foreign *ForeignKey Primary *PrimaryKey Unique *Unique Check *Check Column *Column }
Golang, why dont you implement unions
func MergeDropColRefs ¶ added in v1.0.0
func MergeDropCompositeTypeColumnRefs ¶
func MergeDropCompositeTypeColumnRefs( r *StmtCtx, lt *Type, ts *MergeTableCtx, ss *MergeScriptCtx, c *Column) []MergeDropCtx
func MergeDropNewC ¶ added in v1.0.0
func MergeDropNewC(tablename string, c *Column) MergeDropCtx
func MergeDropNewFK ¶ added in v1.0.0
func MergeDropNewFK(tableName string, fk *ForeignKey) MergeDropCtx
func MergeDropNewPK ¶ added in v1.0.0
func MergeDropNewPK(tableName string, pk *PrimaryKey) MergeDropCtx
func MergeDropNewUnique ¶ added in v1.0.0
func MergeDropNewUnique(tablename string, u *Unique) MergeDropCtx
func MergeDropPkRefs ¶ added in v1.0.0
func MergeDropPkRefs( m *StmtCtx, tableName string, tables []Table, drop *string) []MergeDropCtx
func MergeDropTypeRefs ¶
func MergeDropTypeRefs( m *StmtCtx, ts *MergeTableCtx, ss *MergeScriptCtx, lt *Type) []MergeDropCtx
func (MergeDropCtx) IsC ¶ added in v1.0.0
func (d MergeDropCtx) IsC() bool
func (MergeDropCtx) IsCh ¶ added in v1.0.0
func (d MergeDropCtx) IsCh() bool
func (MergeDropCtx) IsFk ¶ added in v1.0.0
func (d MergeDropCtx) IsFk() bool
func (MergeDropCtx) IsPk ¶ added in v1.0.0
func (d MergeDropCtx) IsPk() bool
func (MergeDropCtx) IsUq ¶ added in v1.0.0
func (d MergeDropCtx) IsUq() bool
type MergeScriptCtx ¶ added in v1.0.0
type MergeTableCtx ¶ added in v1.0.0
type MergeTypeCtx ¶
type MergeTypeCtx struct {
// contains filtered or unexported fields
}
type PrimaryKey ¶ added in v1.0.0
type PrimaryKey struct {
Constraint `yaml:",inline"`
}
func RemoteGetAllPK ¶
func RemoteGetAllPK(db *sql.DB, tableName string) (*PrimaryKey, error)
type StmtCtx ¶
type StmtCtx struct { // types dont really depend on the tables in pg DropType func(*Type) string AddType func(*Type) string // AddColumn func(string, *Column) string AlterColumn func(string, *Column, *Column) string DropColumn func(string, *Column) string ColumnType func(*Column) string AddIndex func(string, *Index) string DropIndex func(string, *Index) string DropConstraint func(string, *Constraint) string AddUnique func(string, *Unique) string AddCheck func(string, *Check) string AddFK func(string, *ForeignKey) string AddPK func(string, *PrimaryKey) string CreateTable func(*Table) string DropTable func(*Table) string }
type Table ¶ added in v1.0.0
type Table struct { Name string Type string Columns []Column Foreign []ForeignKey Unique []Unique Primary *PrimaryKey Check []Check Indexes []Index }
func MergeFindTable ¶ added in v1.0.0
func RemoteGetMatchedTables ¶
type Type ¶
func MergeFindType ¶
type Unique ¶ added in v1.0.0
type Unique struct {
Constraint `yaml:",inline"`
}
Click to show internal directories.
Click to hide internal directories.