Documentation ¶
Index ¶
- Constants
- Variables
- type ColumnDef
- type Config
- type DatabaseDef
- type Error
- type Executor
- func (o *Executor) Enter(in ast.Node) (out ast.Node, skipChildren bool)
- func (o *Executor) Exec(sql string) error
- func (o *Executor) GetCurrentDatabase() string
- func (o *Executor) GetDatabases() []string
- func (o *Executor) GetTableDef(databaseName, tableName string) (*TableDef, error)
- func (o *Executor) GetTables(databaseName string) ([]string, error)
- func (o *Executor) IsDdl(sql string) (bool, error)
- func (o *Executor) Leave(in ast.Node) (out ast.Node, ok bool)
- func (o *Executor) Reset()
- func (o *Executor) Restore(data []byte) error
- func (o *Executor) Snapshot() ([]byte, error)
- type IndexDef
- type IndexType
- type Indices
- type TableDef
Constants ¶
View Source
const ( IndexType_NONE IndexType = "" IndexType_PRI = "PRI" IndexType_UNI = "UNI" IndexType_MUL = "MUL" )
View Source
const ( // Mark whether an index is generated implicitly IndexFlag_Generated uint = 1 << iota IndexFlag_FullText IndexFlag_HasNullPart )
View Source
const ( TypeDecimal byte = 0 TypeTiny byte = 1 TypeShort byte = 2 TypeLong byte = 3 TypeFloat byte = 4 TypeDouble byte = 5 TypeNull byte = 6 TypeTimestamp byte = 7 TypeLonglong byte = 8 TypeInt24 byte = 9 TypeDate byte = 10 /* Original name was TypeTime, renamed to Duration to resolve the conflict with Go type Time.*/ TypeDuration byte = 11 TypeDatetime byte = 12 TypeYear byte = 13 TypeNewDate byte = 14 TypeVarchar byte = 15 TypeBit byte = 16 TypeJSON byte = 0xf5 TypeNewDecimal byte = 0xf6 TypeEnum byte = 0xf7 TypeSet byte = 0xf8 TypeTinyBlob byte = 0xf9 TypeMediumBlob byte = 0xfa TypeLongBlob byte = 0xfb TypeBlob byte = 0xfc TypeVarString byte = 0xfd TypeString byte = 0xfe TypeGeometry byte = 0xff )
MySQL type information.
Variables ¶
View Source
var ( ErrParse = NewError(mysql.ErrParse, "") // ErrNoDB return for no database selected ErrNoDB = NewError(mysql.ErrNoDB, "No database selected") // ErrDBDropExists returns for dropping a non-existent database. ErrDBDropExists = NewError(mysql.ErrDBDropExists, "Can't drop database '%s'; database doesn't exist") // ErrBadDB returns for database not exists. ErrBadDB = NewError(mysql.ErrBadDB, "Unknown database '%s'") // ErrNoSuchTable returns for table not exists. ErrNoSuchTable = NewError(mysql.ErrNoSuchTable, "Table '%s.%s' doesn't exist") // ErrErrBadField returns for column not exists. ErrErrBadField = NewError(mysql.ErrBadField, "Unknown column '%s' in '%s'") // ErrErrWrongFkDef returns for foreign key not match. ErrErrWrongFkDef = NewError(mysql.ErrWrongFkDef, "Incorrect foreign key definition for '%s': Key reference and table reference don't match") // ErrCannotAddForeign returns for foreign key exists. ErrCannotAddForeign = NewError(mysql.ErrCannotAddForeign, "Cannot add foreign key constraint") // ErrCantDropFieldOrKey returns for foreign key not exists. ErrCantDropFieldOrKey = NewError(mysql.ErrCantDropFieldOrKey, "Can't DROP '%s'; check that column/key exists") // ErrErrDBCreateExists returns for database already exists. ErrErrDBCreateExists = NewError(mysql.ErrDBCreateExists, "Can't create database '%s'; database exists") // ErrTableExists returns for table already exists. ErrTableExists = NewError(mysql.ErrTableExists, "Table '%s' already exists") // ErrBadTable returns for dropping a non-existent table. ErrBadTable = NewError(mysql.ErrBadTable, "Unknown table '%s.%s'") // ErrDupFieldName returns for column already exists. ErrDupFieldName = NewError(mysql.ErrDupFieldName, "Duplicate column name '%s'") // ErrDupIndex returns for index already exists. ErrDupIndex = NewError(mysql.ErrDupIndex, "Duplicate Index") // ErrDupKeyName returns for index duplicate when rename index. ErrDupKeyName = NewError(mysql.ErrDupKeyName, "Duplicate key name '%s'") // ErrKeyDoesNotExist returns for index not exists. ErrKeyDoesNotExist = NewError(mysql.ErrKeyDoesNotExist, "Key '%s' doesn't exist in table '%s'") // ErrMultiplePriKey returns for multiple primary keys. ErrMultiplePriKey = NewError(mysql.ErrMultiplePriKey, "Multiple primary key defined") // ErrTooManyKeyParts returns for too many key parts. ErrTooManyKeyParts = NewError(mysql.ErrTooManyKeyParts, "Too many key parts specified; max %d parts allowed") )
Functions ¶
This section is empty.
Types ¶
type ColumnDef ¶
type Config ¶
type Config struct { // This server's default charset, like mysql's charset_server CharsetServer string LowerCaseTableNames bool // If needAtomic is true, Exec() will have no effects if error happens NeedAtomic bool }
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type DatabaseDef ¶
type Executor ¶
func NewExecutor ¶
func (*Executor) GetCurrentDatabase ¶
func (*Executor) GetTableDef ¶
Get definition of specified table
type IndexDef ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.