Documentation ¶
Index ¶
- Variables
- func GetPrimaryKey(stmt *ast.CreateTableStmt) (map[string]struct{}, bool)
- func HasOneInOptions(Options []*ast.ColumnOption, opTp ...ast.ColumnOptionType) bool
- func IsAllInOptions(Options []*ast.ColumnOption, opTp ...ast.ColumnOptionType) bool
- func MysqlDataTypeIsBlob(tp byte) bool
- func ParseCreateTableStmt(dbtype string, sql string) (*ast.CreateTableStmt, error)
- func RemoveArrayRepeat(input []string) (output []string)
- type Context
- func (c *Context) AddSchema(name string)
- func (c *Context) AddTable(schemaName, tableName string, table *TableInfo)
- func (c *Context) DelSchema(name string)
- func (c *Context) DelTable(schemaName, tableName string)
- func (c *Context) GetSchema(schemaName string) (*SchemaInfo, bool)
- func (c *Context) GetTable(schemaName, tableName string) (*TableInfo, bool)
- func (c *Context) HasLoadSchemas() bool
- func (c *Context) HasLoadTables(schemaName string) (hasLoad bool)
- func (c *Context) HasSchema(schemaName string) (has bool)
- func (c *Context) HasTable(schemaName, tableName string) (has bool)
- func (c *Context) LoadSchemas(schemas []string)
- func (c *Context) LoadTables(schemaName string, tablesName []string)
- func (c *Context) SetSchemasLoad()
- func (ctx *Context) UpdateContext(node ast.Node, dbtype string)
- func (c *Context) UseSchema(schema string)
- type SchemaInfo
- type TableChecker
- type TableInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ColumnOptionMap = map[ast.ColumnOptionType]string{ ast.ColumnOptionNotNull: "NOT NULL", ast.ColumnOptionNull: "NULL", ast.ColumnOptionAutoIncrement: "AUTO_INCREMENT", ast.ColumnOptionPrimaryKey: "PRIMARY KEY", ast.ColumnOptionUniqKey: "UNIQUE KEY", }
Functions ¶
func GetPrimaryKey ¶
func GetPrimaryKey(stmt *ast.CreateTableStmt) (map[string]struct{}, bool)
func HasOneInOptions ¶
func HasOneInOptions(Options []*ast.ColumnOption, opTp ...ast.ColumnOptionType) bool
func IsAllInOptions ¶
func IsAllInOptions(Options []*ast.ColumnOption, opTp ...ast.ColumnOptionType) bool
func MysqlDataTypeIsBlob ¶
func ParseCreateTableStmt ¶
func ParseCreateTableStmt(dbtype string, sql string) (*ast.CreateTableStmt, error)
func RemoveArrayRepeat ¶
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func (*Context) HasLoadSchemas ¶
func (*Context) HasLoadTables ¶
func (*Context) LoadSchemas ¶
func (*Context) LoadTables ¶
func (*Context) SetSchemasLoad ¶
func (c *Context) SetSchemasLoad()
type SchemaInfo ¶
type TableChecker ¶
type TableChecker struct {
// contains filtered or unexported fields
}
type TableInfo ¶
type TableInfo struct { Size float64 // OriginalTable save parser object from db by query "show create table ..."; // using in inspect and generate rollback sql OriginalTable *ast.CreateTableStmt // MergedTable *ast.CreateTableStmt // save alter table parse object from input sql; AlterTables []*ast.AlterTableStmt // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.