Documentation
¶
Overview ¶
TODO: Normalize implicit things in input first, and then compare
This package has SQL parser, its abstraction and SQL generator. Never touch database.
Index ¶
- Constants
- func GenerateIdempotentDDLs(mode GeneratorMode, desiredSQL string, currentSQL string) ([]string, error)
- type AddForeignKey
- type AddIndex
- type AddPrimaryKey
- type Column
- type ColumnKeyOption
- type CreateIndex
- type CreateTable
- type DDL
- type ForeignKey
- type Generator
- type GeneratorMode
- type Index
- type IndexColumn
- type Table
- type Value
- type ValueType
Constants ¶
View Source
const ( ValueTypeStr = ValueType(iota) ValueTypeInt ValueTypeFloat ValueTypeHexNum ValueTypeHex ValueTypeValArg ValueTypeBit )
View Source
const ( ColumnKeyNone = ColumnKeyOption(iota) ColumnKeyPrimary ColumnKeySpatialKey ColumnKeyUnique ColumnKeyUniqueKey ColumnKey )
View Source
const ( GeneratorModeMysql = GeneratorMode(iota) GeneratorModePostgres )
Variables ¶
This section is empty.
Functions ¶
func GenerateIdempotentDDLs ¶
func GenerateIdempotentDDLs(mode GeneratorMode, desiredSQL string, currentSQL string) ([]string, error)
Parse argument DDLs and call `generateDDLs()`
Types ¶
type AddForeignKey ¶ added in v0.4.0
type AddForeignKey struct {
// contains filtered or unexported fields
}
func (*AddForeignKey) Statement ¶ added in v0.4.0
func (a *AddForeignKey) Statement() string
type AddPrimaryKey ¶ added in v0.3.3
type AddPrimaryKey struct {
// contains filtered or unexported fields
}
func (*AddPrimaryKey) Statement ¶ added in v0.3.3
func (a *AddPrimaryKey) Statement() string
type ColumnKeyOption ¶
type ColumnKeyOption int
type CreateIndex ¶ added in v0.2.0
type CreateIndex struct {
// contains filtered or unexported fields
}
func (*CreateIndex) Statement ¶ added in v0.2.0
func (c *CreateIndex) Statement() string
type CreateTable ¶
type CreateTable struct {
// contains filtered or unexported fields
}
func (*CreateTable) Statement ¶
func (c *CreateTable) Statement() string
type ForeignKey ¶ added in v0.4.0
type ForeignKey struct {
// contains filtered or unexported fields
}
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
This struct holds simulated schema states during GenerateIdempotentDDLs().
type GeneratorMode ¶ added in v0.2.0
type GeneratorMode int
type IndexColumn ¶
type IndexColumn struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.