Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTableExprs(tabExprs TableExprs, tableNames interface{}) (err error)
- func CheckTableExprsInSelect(stmt SelectStatement, tableNames interface{}) (err error)
- func ForceEOF(yylex interface{})
- func GetColName(node Expr) string
- func IsOnlySystemDBInTableExprs(tabExprs TableExprs) bool
- func IsSystemDB(db string) bool
- func SetAllowComments(yylex interface{}, allow bool)
- func SetLimitInSelect(statement SelectStatement, maxRowCount int)
- func SetParseTree(yylex interface{}, stmt Statement)
- func SplitSQLStatement(multiSQL string) []string
- func String(node SQLNode) string
- type AddForeignKeySpec
- type AddIndexSpec
- type AddOrModifyColumnSpec
- type AddPrimaryKeySpec
- type AddUniqueIndexSpec
- type AdminStatement
- type AliasedTableExpr
- type AlterSpecification
- type AlterSpecifications
- type AlterTable
- type AndExpr
- type Begin
- type BinaryExpr
- type BoolExpr
- type CaseExpr
- type ChangeColumnSpec
- type ColName
- type ColNames
- type ColumnDefinition
- type Columns
- type Comments
- type Commit
- type ComparisonExpr
- type CreateColumnDefinition
- type CreateDefinition
- type CreateDefinitions
- type CreateForeignKeyDefinition
- type CreateIndex
- type CreateIndexDefinition
- type CreatePrimaryKeyDefinition
- type CreateTable
- type CreateUniqueIndexDefinition
- type DDLStatement
- type DataType
- type Delete
- type DisableKeysSpec
- type DropColumnSpec
- type DropForeignKeySpec
- type DropIndex
- type DropIndexSpec
- type DropPrimaryKeySpec
- type DropTable
- type EnableKeysSpec
- type ExistsExpr
- type Explain
- type Expr
- type FirstOrAfterColumn
- type FuncExpr
- type GroupBy
- type IndexColName
- type IndexColNames
- type IndexHints
- type Insert
- type InsertRows
- type JoinTableExpr
- type KillConnection
- type KillQuery
- type KillStatement
- type LikeExpr
- type Limit
- type NonStarExpr
- type NotExpr
- type NullCheck
- type NullVal
- type NumVal
- type OnDup
- type OptionKeyValue
- type OptionKeyValues
- type OrExpr
- type Order
- type OrderBy
- type ParenBoolExpr
- type ParenTableExpr
- type RangeCond
- type RenameTable
- type Replace
- type Rollback
- type SQLNode
- type Select
- type SelectExpr
- type SelectExprs
- type SelectStatement
- type SetCharset
- type SetNames
- type SetStatement
- type SetTransactionIsolationLevel
- type SetVariable
- type ShowCharset
- type ShowCollation
- type ShowColumns
- type ShowCreateDatabase
- type ShowCreateFunction
- type ShowCreateProcedure
- type ShowCreateTable
- type ShowCreateTrigger
- type ShowCreateView
- type ShowDatabases
- type ShowEngines
- type ShowFullColumns
- type ShowFullProcessList
- type ShowFullTables
- type ShowFunctionStatus
- type ShowIndex
- type ShowPlugins
- type ShowProcedureStatus
- type ShowProcessList
- type ShowProfiles
- type ShowSlaveStatus
- type ShowStatement
- type ShowStatus
- type ShowTableStatus
- type ShowTables
- type ShowTriggers
- type ShowVariables
- type SimpleSelect
- type SimpleTableExpr
- type SpaceSplitExpr
- type SpaceSplitExprs
- type StarExpr
- type Statement
- type StrVal
- type Subquery
- type TableExpr
- type TableExprs
- type TableName
- type Tokenizer
- type TrackedBuffer
- type TransactionStatement
- type Tuple
- type UnaryExpr
- type Union
- type Update
- type UpdateExpr
- type UpdateExprs
- type UseDB
- type ValArg
- type ValExpr
- func CheckColumnInBoolExpr(expr BoolExpr, colName string) (strOrNumValue ValExpr, err error)
- func CheckColumnInInsertOrReplace(columns Columns, insertRows InsertRows, onDup OnDup, colName string) (strOrNumValue ValExpr, err error)
- func CheckColumnInSelect(statement SelectStatement, colName string) (strOrNumValue ValExpr, err error)
- func CheckColumnInTableExpr(tabExpr TableExpr, colName string) (strOrNumValue ValExpr, err error)
- type ValExprs
- type ValTuple
- type Values
- type When
- type Where
- type WhereExpr
Constants ¶
const ( AST_JOIN = "join" AST_STRAIGHT_JOIN = "straight_join" AST_LEFT_JOIN = "left join" AST_RIGHT_JOIN = "right join" AST_CROSS_JOIN = "cross join" AST_NATURAL_JOIN = "natural join" )
JoinTableExpr.Join
const ( AST_USE = "use" AST_IGNORE = "ignore" AST_FORCE = "force" )
const ( AST_WHERE = "where" AST_HAVING = "having" )
Where.Type
const ( AST_EQ = "=" AST_LT = "<" AST_GT = ">" AST_LE = "<=" AST_GE = ">=" AST_NE = "!=" AST_NSE = "<=>" AST_IN = "in" AST_NOT_IN = "not in" AST_LIKE = "like" AST_NOT_LIKE = "not like" )
ComparisonExpr.Operator
const ( AST_BETWEEN = "between" AST_NOT_BETWEEN = "not between" )
RangeCond.Operator
const ( AST_IS_NULL = "is null" AST_IS_NOT_NULL = "is not null" )
NullCheck.Operator
const ( AST_BITAND = '&' AST_BITOR = '|' AST_BITXOR = '^' AST_PLUS = '+' AST_MINUS = '-' AST_MULT = '*' AST_DIV = '/' AST_MOD = '%' )
BinaryExpr.Operator
const ( AST_UPLUS = '+' AST_UMINUS = '-' AST_TILDA = '~' )
UnaryExpr.Operator
const ( AST_ASC = "asc" AST_DESC = "desc" )
Order.Direction
const ( AST_FOR_UPDATE = " for update" AST_SHARE_MODE = " lock in share mode" )
Select.Lock
const ( AST_UNION = "union" AST_UNION_ALL = "union all" AST_SET_MINUS = "minus" AST_EXCEPT = "except" AST_INTERSECT = "intersect" )
Union.Type
const ACTION = 57644
const ADD = 57651
const AFTER = 57650
const ALL = 57359
const ALTER = 57582
const AND = 57398
const ARMSCII8 = 57430
const ARMSCII8_BIN = 57471
const ARMSCII8_GENERAL_CI = 57470
const AS = 57361
const ASC = 57364
const ASCII = 57431
const ASCII_BIN = 57473
const ASCII_GENERAL_CI = 57472
const (
AST_DISTINCT = "distinct "
)
Select.Distinct
const AUTO_INCREMENT = 57628
const BEGIN = 57414
const BETWEEN = 57400
const BIG5 = 57432
const BIG5_BIN = 57475
const BIG5_CHINESE_CI = 57474
const BIGINT = 57604
const BINARY = 57433
const BIT = 57596
const BLOB = 57624
const BOOL = 57598
const BOOLEAN = 57599
const BTREE = 57594
const BY = 57356
const CASCADE = 57642
const CASE = 57401
const CHANGE = 57653
const CHAR = 57614
const CHARACTER = 57428
const CHARSET = 57427
const COLLATE = 57580
const COLLATION = 57429
const COLUMN = 57652
const COLUMNS = 57566
const COLUMN_FORMAT = 57633
const COMMENT = 57632
const COMMENTS = 57380
const COMMIT = 57417
const COMMITTED = 57422
const CONNECTION = 57659
const CONSTRAINT = 57647
const CP1250 = 57434
const CP1250_BIN = 57477
const CP1250_GENERAL_CI = 57476
const CP1251 = 57435
const CP1251_BIN = 57480
const CP1251_GENERAL_CI = 57478
const CP1251_GENERAL_CS = 57479
const CP1256 = 57436
const CP1256_BIN = 57482
const CP1256_GENERAL_CI = 57481
const CP1257 = 57437
const CP1257_BIN = 57484
const CP1257_GENERAL_CI = 57483
const CP850 = 57438
const CP850_BIN = 57486
const CP850_GENERAL_CI = 57485
const CP852 = 57439
const CP852_BIN = 57488
const CP852_GENERAL_CI = 57487
const CP866 = 57440
const CP866_BIN = 57490
const CP866_GENERAL_CI = 57489
const CP932 = 57441
const CP932_BIN = 57492
const CP932_JAPANESE_CI = 57491
const CREATE = 57581
const CROSS = 57392
const DATABASE = 57562
const DATABASES = 57560
const DATE = 57609
const DATETIME = 57612
const DEC8 = 57442
const DEC8_BIN = 57494
const DEC8_SWEDISH_CI = 57493
const DECIMAL = 57608
const DEFAULT = 57370
const DELETE = 57350
const DESC = 57365
const DESCRIBE = 57375
const DISABLE = 57656
const DISK = 57636
const DISTINCT = 57360
const DOUBLE = 57606
const DROP = 57583
const DUPLICATE = 57368
const DYNAMIC = 57635
const ELSE = 57404
const ENABLE = 57655
const END = 57413
const ENGINE = 57629
const ENGINES = 57564
const ENUM = 57627
const EOFCHAR = 0x100
EOFCHAR EOF char.
const EUCJPMS = 57443
const EUCJPMS_BIN = 57496
const EUCJPMS_JAPANESE_CI = 57495
const EUCKR = 57444
const EUCKR_BIN = 57498
const EUCKR_KOREAN_CI = 57497
const EXCEPT = 57383
const EXISTS = 57362
const EXPLAIN = 57374
const FIELDS = 57567
const FIRST = 57649
const FIXED = 57634
const FLOAT = 57607
const FOR = 57358
const FORCE = 57395
const FOREIGN = 57648
const FROM = 57351
const FULL = 57385
const FULLTEXT = 57592
const FUNCTION = 57569
const GB2312 = 57445
const GB2312_BIN = 57500
const GB2312_CHINESE_CI = 57499
const GBK = 57446
const GBK_BIN = 57502
const GBK_CHINESE_CI = 57501
const GE = 57406
const GEOSTD8 = 57447
const GEOSTD8_BIN = 57504
const GEOSTD8_GENERAL_CI = 57503
const GLOBAL = 57557
const GREEK = 57448
const GREEK_BIN = 57506
const GREEK_GENERAL_CI = 57505
const GROUP = 57353
const HASH = 57595
const HAVING = 57354
const HEBREW = 57449
const HEBREW_BIN = 57508
const HEBREW_GENERAL_CI = 57507
const HP8 = 57450
const HP8_BIN = 57510
const HP8_ENGLISH_CI = 57509
const ID = 57376
const IF = 57590
const IGNORE = 57589
const IN = 57411
const INDEX = 57586
const INDEXES = 57570
const INNER = 57390
const INSERT = 57348
const INT = 57602
const INTEGER = 57603
const INTERSECT = 57384
const INTO = 57367
const IS = 57409
const ISOLATION = 57419
const JOIN = 57386
const KEY = 57369
const KEYBCS2 = 57451
const KEYBCS2_BIN = 57512
const KEYBCS2_GENERAL_CI = 57511
const KEYS = 57571
const KILL = 57657
const KOI8R = 57452
const KOI8R_BIN = 57514
const KOI8R_GENERAL_CI = 57513
const KOI8U = 57453
const KOI8U_BIN = 57516
const KOI8U_GENERAL_CI = 57515
const LATIN1 = 57454
const LATIN1_BIN = 57519
const LATIN1_GENERAL_CI = 57517
const LATIN1_GENERAL_CS = 57518
const LATIN2 = 57455
const LATIN2_BIN = 57521
const LATIN2_GENERAL_CI = 57520
const LATIN5 = 57456
const LATIN5_BIN = 57523
const LATIN5_TURKISH_CI = 57522
const LATIN7 = 57457
const LATIN7_BIN = 57526
const LATIN7_GENERAL_CI = 57524
const LATIN7_GENERAL_CS = 57525
const LE = 57405
const LEFT = 57388
const LEVEL = 57420
const LEX_ERROR = 57346
const LIKE = 57410
const LIMIT = 57357
const LOCK = 57372
const LONGBLOB = 57626
const LONGTEXT = 57621
const MACCE = 57458
const MACCE_BIN = 57528
const MACCE_GENERAL_CI = 57527
const MACROMAN = 57459
const MACROMAN_BIN = 57530
const MACROMAN_GENERAL_CI = 57529
const MATCH = 57638
const MEDIUMBLOB = 57625
const MEDIUMINT = 57601
const MEDIUMTEXT = 57620
const MEMORY = 57637
const MINUS = 57382
const MODIFY = 57654
const NAMES = 57426
const NATURAL = 57393
const NCHAR = 57615
const NE = 57407
const NO = 57643
const NOT = 57399
const NULL = 57363
const NULL_SAFE_EQUAL = 57408
const NUMBER = 57378
const NVARCHAR = 57617
const OFFSET = 57579
const ON = 57396
const OR = 57397
const ORDER = 57355
const OUTER = 57391
const PARTIAL = 57639
const PLUGINS = 57574
const POSITION = 57660
const PRIMARY = 57630
const PROCEDURE = 57568
const PROCESSLIST = 57575
const PROFILES = 57577
const QUERY = 57658
const READ = 57421
const REAL = 57605
const REFERENCES = 57631
const RENAME = 57584
const REPEATABLE = 57424
const REPLACE = 57578
const RESTRICT = 57641
const RIGHT = 57389
const ROLLBACK = 57418
const SCHEMAS = 57561
const SELECT = 57347
const SERIALIZABLE = 57425
const SESSION = 57556
const SET = 57371
const SHOW = 57373
const SIMPLE = 57640
const SJIS = 57460
const SJIS_BIN = 57532
const SJIS_JAPANESE_CI = 57531
const SLAVE = 57576
const SMALLINT = 57600
const START = 57415
const STATUS = 57559
const STORAGE = 57563
const STRAIGHT_JOIN = 57387
const STRING = 57377
const SWE7 = 57461
const SWE7_BIN = 57534
const SWE7_SWEDISH_CI = 57533
const TABLE = 57585
const TABLES = 57565
const TEXT = 57619
const THEN = 57403
const TIME = 57610
const TIMESTAMP = 57611
const TINYBLOB = 57623
const TINYINT = 57597
const TINYTEXT = 57618
const TIS620 = 57462
const TIS620_BIN = 57536
const TIS620_THAI_CI = 57535
const TO = 57588
const TRANSACTION = 57416
const TRIGGER = 57572
const TRIGGERS = 57573
const UCS2 = 57463
const UCS2_BIN = 57539
const UCS2_GENERAL_CI = 57537
const UCS2_UNICODE_CI = 57538
const UJIS = 57464
const UJIS_BIN = 57541
const UJIS_JAPANESE_CI = 57540
const UNARY = 57412
const UNCOMMITTED = 57423
const UNION = 57381
const UNIQUE = 57591
const UNSIGNED = 57645
const UPDATE = 57349
const USE = 57394
const USING = 57593
const UTF16 = 57465
const UTF16LE = 57466
const UTF16LE_BIN = 57546
const UTF16LE_GENERAL_CI = 57545
const UTF16_BIN = 57544
const UTF16_GENERAL_CI = 57542
const UTF16_UNICODE_CI = 57543
const UTF32 = 57467
const UTF32_BIN = 57549
const UTF32_GENERAL_CI = 57547
const UTF32_UNICODE_CI = 57548
const UTF8 = 57468
const UTF8MB4 = 57469
const UTF8MB4_BIN = 57555
const UTF8MB4_GENERAL_CI = 57553
const UTF8MB4_UNICODE_CI = 57554
const UTF8_BIN = 57552
const UTF8_GENERAL_CI = 57550
const UTF8_UNICODE_CI = 57551
const VALUES = 57366
const VALUE_ARG = 57379
const VARBINARY = 57622
const VARCHAR = 57616
const VARIABLES = 57558
const VIEW = 57587
const WHEN = 57402
const WHERE = 57352
const YEAR = 57613
const ZEROFILL = 57646
Variables ¶
var ( SHARE = []byte("share") MODE = []byte("mode") IF_BYTES = []byte("if") VALUES_BYTES = []byte("values") )
Functions ¶
func CheckTableExprs ¶
func CheckTableExprs(tabExprs TableExprs, tableNames interface{}) (err error)
CheckTableExprs remove db and check table's name.
func CheckTableExprsInSelect ¶
func CheckTableExprsInSelect(stmt SelectStatement, tableNames interface{}) (err error)
CheckTableExprsInSelect remove db and check table's name.
func GetColName ¶
GetColName returns the column name, only if it's a simple expression. Otherwise, it returns "".
func IsOnlySystemDBInTableExprs ¶
func IsOnlySystemDBInTableExprs(tabExprs TableExprs) bool
IsOnlySystemDBInTableExprs only system db in table exprs.
func SetAllowComments ¶
func SetAllowComments(yylex interface{}, allow bool)
SetAllowComments set allow comments.
func SetLimitInSelect ¶
func SetLimitInSelect(statement SelectStatement, maxRowCount int)
SetLimitInSelect set limit expression in select statement.
func SplitSQLStatement ¶
SplitSQLStatement is to split multi-sql to single-sql.
Types ¶
type AddForeignKeySpec ¶
type AddForeignKeySpec struct { Symbol []byte IndexColumns IndexColNames ReferenceDef []byte }
AddForeignKeySpec add foreign key specification
func (*AddForeignKeySpec) Format ¶
func (node *AddForeignKeySpec) Format(buf *TrackedBuffer)
Format AddForeignKeySpec
func (*AddForeignKeySpec) IAlterSpecification ¶
func (node *AddForeignKeySpec) IAlterSpecification()
type AddIndexSpec ¶
type AddIndexSpec struct { Name []byte IndexType []byte IndexColumns IndexColNames }
AddIndexSpec add index specification
func (*AddIndexSpec) Format ¶
func (node *AddIndexSpec) Format(buf *TrackedBuffer)
Format AddIndexSpec
func (*AddIndexSpec) IAlterSpecification ¶
func (node *AddIndexSpec) IAlterSpecification()
type AddOrModifyColumnSpec ¶
type AddOrModifyColumnSpec struct { Action string ColumnName *ColName ColumnDef *ColumnDefinition FirstOrAfterColumn *FirstOrAfterColumn }
AddOrModifyColumnSpec add column specification
func (*AddOrModifyColumnSpec) Format ¶
func (node *AddOrModifyColumnSpec) Format(buf *TrackedBuffer)
Format AddOrModifyColumnSpec
func (*AddOrModifyColumnSpec) IAlterSpecification ¶
func (node *AddOrModifyColumnSpec) IAlterSpecification()
type AddPrimaryKeySpec ¶
type AddPrimaryKeySpec struct { Symbol []byte IndexType []byte IndexColumns IndexColNames }
AddPrimaryKeySpec add primary key specification
func (*AddPrimaryKeySpec) Format ¶
func (node *AddPrimaryKeySpec) Format(buf *TrackedBuffer)
Format AddPrimaryKeySpec
func (*AddPrimaryKeySpec) IAlterSpecification ¶
func (node *AddPrimaryKeySpec) IAlterSpecification()
type AddUniqueIndexSpec ¶
type AddUniqueIndexSpec struct { Symbol []byte Name []byte IndexType []byte IndexColumns IndexColNames }
AddUniqueIndexSpec add unique index specification
func (*AddUniqueIndexSpec) Format ¶
func (node *AddUniqueIndexSpec) Format(buf *TrackedBuffer)
Format AddUniqueIndexSpec
func (*AddUniqueIndexSpec) IAlterSpecification ¶
func (node *AddUniqueIndexSpec) IAlterSpecification()
type AdminStatement ¶
type AdminStatement interface { IStatement() IAdminStatement() SQLNode }
AdminStatement admin statement.
type AliasedTableExpr ¶
type AliasedTableExpr struct { Expr SimpleTableExpr As []byte Hints *IndexHints }
AliasedTableExpr represents a table expression coupled with an optional alias or index hint.
func (*AliasedTableExpr) Format ¶
func (node *AliasedTableExpr) Format(buf *TrackedBuffer)
func (*AliasedTableExpr) ITableExpr ¶
func (*AliasedTableExpr) ITableExpr()
type AlterSpecification ¶
type AlterSpecification interface { IAlterSpecification() SQLNode }
AlterSpecification alter specification
type AlterSpecifications ¶
type AlterSpecifications []AlterSpecification
AlterSpecifications alter specification list
func (AlterSpecifications) Format ¶
func (node AlterSpecifications) Format(buf *TrackedBuffer)
Format AlterSpecifications
type AlterTable ¶
type AlterTable struct { Comments Comments Ignore string Table *TableName AlterSpecs AlterSpecifications }
AlterTable alter table
func (*AlterTable) IDDLStatement ¶
func (node *AlterTable) IDDLStatement()
func (*AlterTable) IStatement ¶
func (node *AlterTable) IStatement()
type AndExpr ¶
type AndExpr struct {
Left, Right BoolExpr
}
AndExpr represents an AND expression.
func (*AndExpr) Format ¶
func (node *AndExpr) Format(buf *TrackedBuffer)
type Begin ¶
type Begin struct { }
Begin statement
func (*Begin) Format ¶
func (node *Begin) Format(buf *TrackedBuffer)
func (*Begin) IStatement ¶
func (node *Begin) IStatement()
func (*Begin) ITransactionStatement ¶
func (node *Begin) ITransactionStatement()
type BinaryExpr ¶
BinaryExpr represents a binary value expression.
func (*BinaryExpr) Format ¶
func (node *BinaryExpr) Format(buf *TrackedBuffer)
func (*BinaryExpr) IExpr ¶
func (*BinaryExpr) IExpr()
func (*BinaryExpr) IValExpr ¶
func (*BinaryExpr) IValExpr()
type BoolExpr ¶
type BoolExpr interface { IBoolExpr() Expr }
BoolExpr represents a boolean expression.
type CaseExpr ¶
CaseExpr represents a CASE expression.
func (*CaseExpr) Format ¶
func (node *CaseExpr) Format(buf *TrackedBuffer)
type ChangeColumnSpec ¶
type ChangeColumnSpec struct { OldColumnName *ColName ColumnName *ColName ColumnDef *ColumnDefinition FirstOrAfterColumn *FirstOrAfterColumn }
ChangeColumnSpec add column specification
func (*ChangeColumnSpec) Format ¶
func (node *ChangeColumnSpec) Format(buf *TrackedBuffer)
Format ChangeColumnSpec
func (*ChangeColumnSpec) IAlterSpecification ¶
func (node *ChangeColumnSpec) IAlterSpecification()
type ColName ¶
type ColName struct {
Name, Qualifier []byte
}
ColName represents a column name.
func (*ColName) Format ¶
func (node *ColName) Format(buf *TrackedBuffer)
type ColumnDefinition ¶
type ColumnDefinition struct { Type *DataType IsNotNull bool DefaultValue ValExpr IsAutoIncrement bool UniqueOrKey []byte ColumnComment ValExpr ColumnFormat []byte ColumnStorage []byte ReferenceDef []byte }
ColumnDefinition column definition
func (*ColumnDefinition) Format ¶
func (node *ColumnDefinition) Format(buf *TrackedBuffer)
Format ColumnDefinition
type Columns ¶
type Columns []SelectExpr
Columns represents an insert column list. The syntax for Columns is a subset of SelectExprs. So, it's castable to a SelectExprs and can be analyzed as such.
func (Columns) Format ¶
func (node Columns) Format(buf *TrackedBuffer)
type Comments ¶
type Comments [][]byte
Comments represents a list of comments.
func (Comments) Format ¶
func (node Comments) Format(buf *TrackedBuffer)
type Commit ¶
type Commit struct { }
Commit statement
func (*Commit) Format ¶
func (node *Commit) Format(buf *TrackedBuffer)
func (*Commit) IStatement ¶
func (node *Commit) IStatement()
func (*Commit) ITransactionStatement ¶
func (node *Commit) ITransactionStatement()
type ComparisonExpr ¶
ComparisonExpr represents a two-value comparison expression.
func (*ComparisonExpr) Format ¶
func (node *ComparisonExpr) Format(buf *TrackedBuffer)
func (*ComparisonExpr) IBoolExpr ¶
func (*ComparisonExpr) IBoolExpr()
func (*ComparisonExpr) IExpr ¶
func (*ComparisonExpr) IExpr()
type CreateColumnDefinition ¶
type CreateColumnDefinition struct { ColumnName *ColName ColumnDef *ColumnDefinition }
CreateColumnDefinition create column definition
func (*CreateColumnDefinition) Format ¶
func (node *CreateColumnDefinition) Format(buf *TrackedBuffer)
Format CreateColumnDefinition
func (*CreateColumnDefinition) ICreateDefinition ¶
func (node *CreateColumnDefinition) ICreateDefinition()
type CreateDefinition ¶
type CreateDefinition interface { SQLNode ICreateDefinition() }
CreateDefinition create definition
type CreateDefinitions ¶
type CreateDefinitions []CreateDefinition
CreateDefinitions create definition list.
func (CreateDefinitions) Format ¶
func (node CreateDefinitions) Format(buf *TrackedBuffer)
Format CreateDefinitions
type CreateForeignKeyDefinition ¶
type CreateForeignKeyDefinition struct { Symbol []byte IndexColumns IndexColNames ReferenceDef []byte }
CreateForeignKeyDefinition create foreign key definition
func (*CreateForeignKeyDefinition) Format ¶
func (node *CreateForeignKeyDefinition) Format(buf *TrackedBuffer)
Format CreateForeignKeyDefinition
func (*CreateForeignKeyDefinition) ICreateDefinition ¶
func (node *CreateForeignKeyDefinition) ICreateDefinition()
type CreateIndex ¶
type CreateIndex struct { Comments Comments IndexCategory []byte Name []byte Table *TableName IndexType []byte IndexColumns IndexColNames IndexOption []byte }
CreateIndex create index statement
func (*CreateIndex) IDDLStatement ¶
func (node *CreateIndex) IDDLStatement()
func (*CreateIndex) IStatement ¶
func (node *CreateIndex) IStatement()
type CreateIndexDefinition ¶
type CreateIndexDefinition struct { Name []byte IndexType []byte IndexColumns IndexColNames }
CreateIndexDefinition create index definition
func (*CreateIndexDefinition) Format ¶
func (node *CreateIndexDefinition) Format(buf *TrackedBuffer)
Format CreateIndexDefinition
func (*CreateIndexDefinition) ICreateDefinition ¶
func (node *CreateIndexDefinition) ICreateDefinition()
type CreatePrimaryKeyDefinition ¶
type CreatePrimaryKeyDefinition struct { Symbol []byte IndexType []byte IndexColumns IndexColNames }
CreatePrimaryKeyDefinition create primary key definition
func (*CreatePrimaryKeyDefinition) Format ¶
func (node *CreatePrimaryKeyDefinition) Format(buf *TrackedBuffer)
Format CreatePrimaryKeyDefinition
func (*CreatePrimaryKeyDefinition) ICreateDefinition ¶
func (node *CreatePrimaryKeyDefinition) ICreateDefinition()
type CreateTable ¶
type CreateTable struct { Comments Comments Table *TableName CreateDefs CreateDefinitions TableOptions OptionKeyValues }
CreateTable create table statement
func (*CreateTable) IDDLStatement ¶
func (node *CreateTable) IDDLStatement()
func (*CreateTable) IStatement ¶
func (node *CreateTable) IStatement()
type CreateUniqueIndexDefinition ¶
type CreateUniqueIndexDefinition struct { Symbol []byte Name []byte IndexType []byte IndexColumns IndexColNames }
CreateUniqueIndexDefinition create unique index definition
func (*CreateUniqueIndexDefinition) Format ¶
func (node *CreateUniqueIndexDefinition) Format(buf *TrackedBuffer)
Format CreateUniqueIndexDefinition
func (*CreateUniqueIndexDefinition) ICreateDefinition ¶
func (node *CreateUniqueIndexDefinition) ICreateDefinition()
type DDLStatement ¶
type DDLStatement interface { IStatement() SQLNode IDDLStatement() }
DDLStatement ddl statement
type DataType ¶
type DataType struct { TypeName string IsUnsigned bool IsZeroFill bool IsBinary bool Charset []byte Collate []byte }
DataType data type.
type Delete ¶
Delete represents a DELETE statement.
func (*Delete) Format ¶
func (node *Delete) Format(buf *TrackedBuffer)
func (*Delete) IStatement ¶
func (node *Delete) IStatement()
type DisableKeysSpec ¶
type DisableKeysSpec struct { }
DisableKeysSpec disable keys specification
func (*DisableKeysSpec) Format ¶
func (node *DisableKeysSpec) Format(buf *TrackedBuffer)
Format DisableKeysSpec
func (*DisableKeysSpec) IAlterSpecification ¶
func (node *DisableKeysSpec) IAlterSpecification()
type DropColumnSpec ¶
type DropColumnSpec struct {
ColumnName *ColName
}
DropColumnSpec drop column specification
func (*DropColumnSpec) Format ¶
func (node *DropColumnSpec) Format(buf *TrackedBuffer)
Format DropColumnSpec
func (*DropColumnSpec) IAlterSpecification ¶
func (node *DropColumnSpec) IAlterSpecification()
type DropForeignKeySpec ¶
type DropForeignKeySpec struct {
Name []byte
}
DropForeignKeySpec drop foreign key specification
func (*DropForeignKeySpec) Format ¶
func (node *DropForeignKeySpec) Format(buf *TrackedBuffer)
Format DropForeignKeySpec
func (*DropForeignKeySpec) IAlterSpecification ¶
func (node *DropForeignKeySpec) IAlterSpecification()
type DropIndex ¶
DropIndex drop index
func (*DropIndex) IDDLStatement ¶
func (node *DropIndex) IDDLStatement()
func (*DropIndex) IStatement ¶
func (node *DropIndex) IStatement()
type DropIndexSpec ¶
type DropIndexSpec struct {
Name []byte
}
DropIndexSpec drop index specification
func (*DropIndexSpec) Format ¶
func (node *DropIndexSpec) Format(buf *TrackedBuffer)
Format DropIndexSpec
func (*DropIndexSpec) IAlterSpecification ¶
func (node *DropIndexSpec) IAlterSpecification()
type DropPrimaryKeySpec ¶
type DropPrimaryKeySpec struct { }
DropPrimaryKeySpec drop primary key specification
func (*DropPrimaryKeySpec) Format ¶
func (node *DropPrimaryKeySpec) Format(buf *TrackedBuffer)
Format DropPrimaryKeySpec
func (*DropPrimaryKeySpec) IAlterSpecification ¶
func (node *DropPrimaryKeySpec) IAlterSpecification()
type DropTable ¶
DropTable drop table
func (*DropTable) IDDLStatement ¶
func (node *DropTable) IDDLStatement()
func (*DropTable) IStatement ¶
func (node *DropTable) IStatement()
type EnableKeysSpec ¶
type EnableKeysSpec struct { }
EnableKeysSpec enable keys specification
func (*EnableKeysSpec) Format ¶
func (node *EnableKeysSpec) Format(buf *TrackedBuffer)
Format EnableKeysSpec
func (*EnableKeysSpec) IAlterSpecification ¶
func (node *EnableKeysSpec) IAlterSpecification()
type ExistsExpr ¶
type ExistsExpr struct {
Subquery *Subquery
}
ExistsExpr represents an EXISTS expression.
func (*ExistsExpr) Format ¶
func (node *ExistsExpr) Format(buf *TrackedBuffer)
func (*ExistsExpr) IBoolExpr ¶
func (*ExistsExpr) IBoolExpr()
func (*ExistsExpr) IExpr ¶
func (*ExistsExpr) IExpr()
type Explain ¶
type Explain struct {
Statement
}
Explain select statement.
func (*Explain) IStatement ¶
func (node *Explain) IStatement()
type FirstOrAfterColumn ¶
FirstOrAfterColumn first or after column
func (*FirstOrAfterColumn) Format ¶
func (node *FirstOrAfterColumn) Format(buf *TrackedBuffer)
Format FirstOrAfterColumn
type FuncExpr ¶
FuncExpr represents a function call.
func (*FuncExpr) Format ¶
func (node *FuncExpr) Format(buf *TrackedBuffer)
type GroupBy ¶
type GroupBy []ValExpr
GroupBy represents a GROUP BY clause.
func (GroupBy) Format ¶
func (node GroupBy) Format(buf *TrackedBuffer)
type IndexColName ¶
IndexColName index column name
func (*IndexColName) Format ¶
func (node *IndexColName) Format(buf *TrackedBuffer)
Format IndexColName
type IndexColNames ¶
type IndexColNames []*IndexColName
IndexColNames index column name list
func (IndexColNames) Format ¶
func (node IndexColNames) Format(buf *TrackedBuffer)
Format IndexColNames
type IndexHints ¶
IndexHints represents a list of index hints.
func (*IndexHints) Format ¶
func (node *IndexHints) Format(buf *TrackedBuffer)
type Insert ¶
type Insert struct { Comments Comments Ignore string Table *TableName Columns Columns Rows InsertRows OnDup OnDup }
Insert represents an INSERT statement.
func (*Insert) Format ¶
func (node *Insert) Format(buf *TrackedBuffer)
func (*Insert) IStatement ¶
func (node *Insert) IStatement()
type InsertRows ¶
type InsertRows interface { IInsertRows() SQLNode }
InsertRows represents the rows for an INSERT statement.
type JoinTableExpr ¶
JoinTableExpr represents a TableExpr that's a JOIN operation.
func (*JoinTableExpr) Format ¶
func (node *JoinTableExpr) Format(buf *TrackedBuffer)
func (*JoinTableExpr) ITableExpr ¶
func (*JoinTableExpr) ITableExpr()
type KillConnection ¶
type KillConnection struct {
ConnectionID NumVal
}
KillConnection kill connection statement.
func (*KillConnection) Format ¶
func (node *KillConnection) Format(buf *TrackedBuffer)
Format KillConnection
func (*KillConnection) GetConnectionID ¶
func (node *KillConnection) GetConnectionID() uint32
func (*KillConnection) IAdminStatement ¶
func (node *KillConnection) IAdminStatement()
func (*KillConnection) IKillStatement ¶
func (node *KillConnection) IKillStatement()
func (*KillConnection) IStatement ¶
func (node *KillConnection) IStatement()
type KillQuery ¶
type KillQuery struct {
ConnectionID NumVal
}
KillQuery kill query statement
func (*KillQuery) GetConnectionID ¶
func (*KillQuery) IAdminStatement ¶
func (node *KillQuery) IAdminStatement()
func (*KillQuery) IKillStatement ¶
func (node *KillQuery) IKillStatement()
func (*KillQuery) IStatement ¶
func (node *KillQuery) IStatement()
type KillStatement ¶
type KillStatement interface { AdminStatement IKillStatement() GetConnectionID() uint32 }
KillStatement kill statement.
type LikeExpr ¶
type LikeExpr struct {
Expr ValExpr
}
LikeExpr Expression
func (*LikeExpr) Format ¶
func (node *LikeExpr) Format(buf *TrackedBuffer)
type Limit ¶
type Limit struct {
Offset, Rowcount ValExpr
}
Limit represents a LIMIT clause.
func (*Limit) Format ¶
func (node *Limit) Format(buf *TrackedBuffer)
func (*Limit) RewriteLimit ¶
type NonStarExpr ¶
NonStarExpr defines a non-'*' select expr.
func (*NonStarExpr) Format ¶
func (node *NonStarExpr) Format(buf *TrackedBuffer)
func (*NonStarExpr) ISelectExpr ¶
func (*NonStarExpr) ISelectExpr()
type NotExpr ¶
type NotExpr struct {
Expr BoolExpr
}
NotExpr represents a NOT expression.
func (*NotExpr) Format ¶
func (node *NotExpr) Format(buf *TrackedBuffer)
type NullCheck ¶
NullCheck represents an IS NULL or an IS NOT NULL expression.
func (*NullCheck) Format ¶
func (node *NullCheck) Format(buf *TrackedBuffer)
type NullVal ¶
type NullVal struct{}
NullVal represents a NULL value.
func (*NullVal) Format ¶
func (node *NullVal) Format(buf *TrackedBuffer)
type NumVal ¶
type NumVal []byte
NumVal represents a number.
func (NumVal) Format ¶
func (node NumVal) Format(buf *TrackedBuffer)
type OnDup ¶
type OnDup UpdateExprs
OnDup represents an ON DUPLICATE KEY clause.
func (OnDup) Format ¶
func (node OnDup) Format(buf *TrackedBuffer)
type OptionKeyValue ¶
OptionKeyValue option key value
func (*OptionKeyValue) Format ¶
func (node *OptionKeyValue) Format(buf *TrackedBuffer)
Format OptionKeyValue
type OptionKeyValues ¶
type OptionKeyValues []*OptionKeyValue
OptionKeyValues option key value list
func (OptionKeyValues) Format ¶
func (node OptionKeyValues) Format(buf *TrackedBuffer)
Format OptionKeyValues
func (OptionKeyValues) IAlterSpecification ¶
func (node OptionKeyValues) IAlterSpecification()
type OrExpr ¶
type OrExpr struct {
Left, Right BoolExpr
}
OrExpr represents an OR expression.
func (*OrExpr) Format ¶
func (node *OrExpr) Format(buf *TrackedBuffer)
type Order ¶
Order represents an ordering expression.
func (*Order) Format ¶
func (node *Order) Format(buf *TrackedBuffer)
type OrderBy ¶
type OrderBy []*Order
OrderBy represents an ORDER By clause.
func (OrderBy) Format ¶
func (node OrderBy) Format(buf *TrackedBuffer)
type ParenBoolExpr ¶
type ParenBoolExpr struct {
Expr BoolExpr
}
ParenBoolExpr represents a parenthesized boolean expression.
func (*ParenBoolExpr) Format ¶
func (node *ParenBoolExpr) Format(buf *TrackedBuffer)
func (*ParenBoolExpr) IBoolExpr ¶
func (*ParenBoolExpr) IBoolExpr()
func (*ParenBoolExpr) IExpr ¶
func (*ParenBoolExpr) IExpr()
type ParenTableExpr ¶
type ParenTableExpr struct {
Expr TableExpr
}
ParenTableExpr represents a parenthesized TableExpr.
func (*ParenTableExpr) Format ¶
func (node *ParenTableExpr) Format(buf *TrackedBuffer)
func (*ParenTableExpr) ITableExpr ¶
func (*ParenTableExpr) ITableExpr()
type RangeCond ¶
RangeCond represents a BETWEEN or a NOT BETWEEN expression.
func (*RangeCond) Format ¶
func (node *RangeCond) Format(buf *TrackedBuffer)
type RenameTable ¶
RenameTable rename table
func (*RenameTable) IDDLStatement ¶
func (node *RenameTable) IDDLStatement()
func (*RenameTable) IStatement ¶
func (node *RenameTable) IStatement()
type Replace ¶
type Replace struct { Comments Comments Table *TableName Columns Columns Rows InsertRows }
Replace represents an REPLACE statement.
func (*Replace) Format ¶
func (node *Replace) Format(buf *TrackedBuffer)
func (*Replace) IStatement ¶
func (node *Replace) IStatement()
type Rollback ¶
type Rollback struct { }
Rollback statement
func (*Rollback) Format ¶
func (node *Rollback) Format(buf *TrackedBuffer)
func (*Rollback) IStatement ¶
func (node *Rollback) IStatement()
func (*Rollback) ITransactionStatement ¶
func (node *Rollback) ITransactionStatement()
type SQLNode ¶
type SQLNode interface {
Format(buf *TrackedBuffer)
}
SQLNode defines the interface for all nodes generated by the parser.
type Select ¶
type Select struct { Comments Comments Distinct string SelectExprs SelectExprs From TableExprs Where *Where GroupBy GroupBy Having *Where OrderBy OrderBy Limit *Limit Lock string }
Select represents a SELECT statement.
func (*Select) IInsertRows ¶
func (node *Select) IInsertRows()
func (*Select) ISelectStatement ¶
func (node *Select) ISelectStatement()
func (*Select) IStatement ¶
func (node *Select) IStatement()
type SelectExpr ¶
type SelectExpr interface { ISelectExpr() SQLNode }
SelectExpr represents a SELECT expression.
type SelectExprs ¶
type SelectExprs []SelectExpr
SelectExprs represents SELECT expressions.
func (SelectExprs) Format ¶
func (node SelectExprs) Format(buf *TrackedBuffer)
type SelectStatement ¶
type SelectStatement interface { IStatement() ISelectStatement() IInsertRows() SQLNode }
SelectStatement any SELECT statement.
type SetCharset ¶
SetCharset set charset.
func (*SetCharset) Format ¶
func (node *SetCharset) Format(buf *TrackedBuffer)
func (*SetCharset) ISetStatement ¶
func (node *SetCharset) ISetStatement()
func (*SetCharset) IStatement ¶
func (node *SetCharset) IStatement()
type SetNames ¶
SetNames set NAMES.
func (*SetNames) Format ¶
func (node *SetNames) Format(buf *TrackedBuffer)
func (*SetNames) ISetStatement ¶
func (node *SetNames) ISetStatement()
func (*SetNames) IStatement ¶
func (node *SetNames) IStatement()
type SetStatement ¶
type SetStatement interface { IStatement() ISetStatement() SQLNode }
SetStatement set statement
type SetTransactionIsolationLevel ¶
type SetTransactionIsolationLevel struct { Comments Comments Scope string // SESSION or GLOBAL IsolationLevel string }
SetTransactionIsolationLevel represents a SET TRANSACTION ISOLATION LEVEL statement.
func (*SetTransactionIsolationLevel) Format ¶
func (node *SetTransactionIsolationLevel) Format(buf *TrackedBuffer)
func (*SetTransactionIsolationLevel) ISetStatement ¶
func (node *SetTransactionIsolationLevel) ISetStatement()
func (*SetTransactionIsolationLevel) IStatement ¶
func (node *SetTransactionIsolationLevel) IStatement()
type SetVariable ¶
type SetVariable struct { Comments Comments Scope string // SESSION or GLOBAL Exprs UpdateExprs }
SetVariable set variable assignment
func (*SetVariable) Format ¶
func (node *SetVariable) Format(buf *TrackedBuffer)
func (*SetVariable) ISetStatement ¶
func (node *SetVariable) ISetStatement()
func (*SetVariable) IStatement ¶
func (node *SetVariable) IStatement()
type ShowCharset ¶
ShowCharset statement
func (*ShowCharset) IShowStatement ¶
func (node *ShowCharset) IShowStatement()
func (*ShowCharset) IStatement ¶
func (node *ShowCharset) IStatement()
type ShowCollation ¶
ShowCollation statement
func (*ShowCollation) Format ¶
func (node *ShowCollation) Format(buf *TrackedBuffer)
Format ShowCollation
func (*ShowCollation) IShowStatement ¶
func (node *ShowCollation) IShowStatement()
func (*ShowCollation) IStatement ¶
func (node *ShowCollation) IStatement()
type ShowColumns ¶
ShowColumns statement
func (*ShowColumns) IShowStatement ¶
func (node *ShowColumns) IShowStatement()
func (*ShowColumns) IStatement ¶
func (node *ShowColumns) IStatement()
type ShowCreateDatabase ¶
ShowCreateDatabase statement
func (*ShowCreateDatabase) Format ¶
func (node *ShowCreateDatabase) Format(buf *TrackedBuffer)
Format ShowCreateDatabase
func (*ShowCreateDatabase) IShowStatement ¶
func (node *ShowCreateDatabase) IShowStatement()
func (*ShowCreateDatabase) IStatement ¶
func (node *ShowCreateDatabase) IStatement()
type ShowCreateFunction ¶
ShowCreateFunction statement
func (*ShowCreateFunction) Format ¶
func (node *ShowCreateFunction) Format(buf *TrackedBuffer)
Format ShowCreateFunction
func (*ShowCreateFunction) IShowStatement ¶
func (node *ShowCreateFunction) IShowStatement()
func (*ShowCreateFunction) IStatement ¶
func (node *ShowCreateFunction) IStatement()
type ShowCreateProcedure ¶
ShowCreateProcedure statement
func (*ShowCreateProcedure) Format ¶
func (node *ShowCreateProcedure) Format(buf *TrackedBuffer)
Format ShowCreateProcedure
func (*ShowCreateProcedure) IShowStatement ¶
func (node *ShowCreateProcedure) IShowStatement()
func (*ShowCreateProcedure) IStatement ¶
func (node *ShowCreateProcedure) IStatement()
type ShowCreateTable ¶
ShowCreateTable statement
func (*ShowCreateTable) Format ¶
func (node *ShowCreateTable) Format(buf *TrackedBuffer)
Format ShowCreateTable
func (*ShowCreateTable) IShowStatement ¶
func (node *ShowCreateTable) IShowStatement()
func (*ShowCreateTable) IStatement ¶
func (node *ShowCreateTable) IStatement()
type ShowCreateTrigger ¶
ShowCreateTrigger statement
func (*ShowCreateTrigger) Format ¶
func (node *ShowCreateTrigger) Format(buf *TrackedBuffer)
Format ShowCreateTrigger
func (*ShowCreateTrigger) IShowStatement ¶
func (node *ShowCreateTrigger) IShowStatement()
func (*ShowCreateTrigger) IStatement ¶
func (node *ShowCreateTrigger) IStatement()
type ShowCreateView ¶
ShowCreateView statement
func (*ShowCreateView) Format ¶
func (node *ShowCreateView) Format(buf *TrackedBuffer)
Format ShowCreateView
func (*ShowCreateView) IShowStatement ¶
func (node *ShowCreateView) IShowStatement()
func (*ShowCreateView) IStatement ¶
func (node *ShowCreateView) IStatement()
type ShowDatabases ¶
ShowDatabases statement
func (*ShowDatabases) Format ¶
func (node *ShowDatabases) Format(buf *TrackedBuffer)
Format ShowDatabases
func (*ShowDatabases) IShowStatement ¶
func (node *ShowDatabases) IShowStatement()
func (*ShowDatabases) IStatement ¶
func (node *ShowDatabases) IStatement()
type ShowEngines ¶
type ShowEngines struct { }
ShowEngines statement
func (*ShowEngines) IShowStatement ¶
func (node *ShowEngines) IShowStatement()
func (*ShowEngines) IStatement ¶
func (node *ShowEngines) IStatement()
type ShowFullColumns ¶
ShowFullColumns statement
func (*ShowFullColumns) Format ¶
func (node *ShowFullColumns) Format(buf *TrackedBuffer)
Format ShowFullColumns
func (*ShowFullColumns) IShowStatement ¶
func (node *ShowFullColumns) IShowStatement()
func (*ShowFullColumns) IStatement ¶
func (node *ShowFullColumns) IStatement()
type ShowFullProcessList ¶
type ShowFullProcessList struct {
Comments Comments
}
ShowFullProcessList statement
func (*ShowFullProcessList) Format ¶
func (node *ShowFullProcessList) Format(buf *TrackedBuffer)
Format ShowFullProcessList
func (*ShowFullProcessList) IShowStatement ¶
func (node *ShowFullProcessList) IShowStatement()
func (*ShowFullProcessList) IStatement ¶
func (node *ShowFullProcessList) IStatement()
type ShowFullTables ¶
ShowFullTables statement
func (*ShowFullTables) Format ¶
func (node *ShowFullTables) Format(buf *TrackedBuffer)
Format ShowFullTables
func (*ShowFullTables) IShowStatement ¶
func (node *ShowFullTables) IShowStatement()
func (*ShowFullTables) IStatement ¶
func (node *ShowFullTables) IStatement()
type ShowFunctionStatus ¶
ShowFunctionStatus statement
func (*ShowFunctionStatus) Format ¶
func (node *ShowFunctionStatus) Format(buf *TrackedBuffer)
Format ShowFunctionStatus
func (*ShowFunctionStatus) IShowStatement ¶
func (node *ShowFunctionStatus) IShowStatement()
func (*ShowFunctionStatus) IStatement ¶
func (node *ShowFunctionStatus) IStatement()
type ShowIndex ¶
ShowIndex statement
func (*ShowIndex) IShowStatement ¶
func (node *ShowIndex) IShowStatement()
func (*ShowIndex) IStatement ¶
func (node *ShowIndex) IStatement()
type ShowPlugins ¶
type ShowPlugins struct { }
ShowPlugins statement
func (*ShowPlugins) IShowStatement ¶
func (node *ShowPlugins) IShowStatement()
func (*ShowPlugins) IStatement ¶
func (node *ShowPlugins) IStatement()
type ShowProcedureStatus ¶
ShowProcedureStatus statement
func (*ShowProcedureStatus) Format ¶
func (node *ShowProcedureStatus) Format(buf *TrackedBuffer)
Format ShowProcedureStatus
func (*ShowProcedureStatus) IShowStatement ¶
func (node *ShowProcedureStatus) IShowStatement()
func (*ShowProcedureStatus) IStatement ¶
func (node *ShowProcedureStatus) IStatement()
type ShowProcessList ¶
type ShowProcessList struct {
Comments Comments
}
ShowProcessList statement
func (*ShowProcessList) Format ¶
func (node *ShowProcessList) Format(buf *TrackedBuffer)
Format ShowProcessList
func (*ShowProcessList) IShowStatement ¶
func (node *ShowProcessList) IShowStatement()
func (*ShowProcessList) IStatement ¶
func (node *ShowProcessList) IStatement()
type ShowProfiles ¶
type ShowProfiles struct { }
ShowProfiles statement
func (*ShowProfiles) Format ¶
func (node *ShowProfiles) Format(buf *TrackedBuffer)
Format ShowProfiles
func (*ShowProfiles) IShowStatement ¶
func (node *ShowProfiles) IShowStatement()
func (*ShowProfiles) IStatement ¶
func (node *ShowProfiles) IStatement()
type ShowSlaveStatus ¶
type ShowSlaveStatus struct {
Comments Comments
}
ShowSlaveStatus statement
func (*ShowSlaveStatus) Format ¶
func (node *ShowSlaveStatus) Format(buf *TrackedBuffer)
Format ShowSlaveStatus
func (*ShowSlaveStatus) IShowStatement ¶
func (node *ShowSlaveStatus) IShowStatement()
func (*ShowSlaveStatus) IStatement ¶
func (node *ShowSlaveStatus) IStatement()
type ShowStatement ¶
type ShowStatement interface { IStatement() IShowStatement() SQLNode }
ShowStatement show statement
type ShowStatus ¶
ShowStatus statement
func (*ShowStatus) IShowStatement ¶
func (node *ShowStatus) IShowStatement()
func (*ShowStatus) IStatement ¶
func (node *ShowStatus) IStatement()
type ShowTableStatus ¶
ShowTableStatus statement
func (*ShowTableStatus) Format ¶
func (node *ShowTableStatus) Format(buf *TrackedBuffer)
Format ShowTableStatus
func (*ShowTableStatus) IShowStatement ¶
func (node *ShowTableStatus) IShowStatement()
func (*ShowTableStatus) IStatement ¶
func (node *ShowTableStatus) IStatement()
type ShowTables ¶
ShowTables statement
func (*ShowTables) IShowStatement ¶
func (node *ShowTables) IShowStatement()
func (*ShowTables) IStatement ¶
func (node *ShowTables) IStatement()
type ShowTriggers ¶
ShowTriggers statement
func (*ShowTriggers) Format ¶
func (node *ShowTriggers) Format(buf *TrackedBuffer)
Format ShowTriggers
func (*ShowTriggers) IShowStatement ¶
func (node *ShowTriggers) IShowStatement()
func (*ShowTriggers) IStatement ¶
func (node *ShowTriggers) IStatement()
type ShowVariables ¶
ShowVariables statement
func (*ShowVariables) Format ¶
func (node *ShowVariables) Format(buf *TrackedBuffer)
Format ShowVariables
func (*ShowVariables) IShowStatement ¶
func (node *ShowVariables) IShowStatement()
func (*ShowVariables) IStatement ¶
func (node *ShowVariables) IStatement()
type SimpleSelect ¶
type SimpleSelect struct { Comments Comments Distinct string SelectExprs SelectExprs Limit *Limit }
SimpleSelect no from and where statement.
func (*SimpleSelect) Format ¶
func (node *SimpleSelect) Format(buf *TrackedBuffer)
func (*SimpleSelect) IInsertRows ¶
func (*SimpleSelect) IInsertRows()
func (*SimpleSelect) ISelectStatement ¶
func (*SimpleSelect) ISelectStatement()
func (*SimpleSelect) IStatement ¶
func (*SimpleSelect) IStatement()
type SimpleTableExpr ¶
type SimpleTableExpr interface { ISimpleTableExpr() SQLNode }
SimpleTableExpr represents a simple table expression.
type SpaceSplitExpr ¶
SpaceSplitExpr represents an space split expression.
func (*SpaceSplitExpr) Format ¶
func (node *SpaceSplitExpr) Format(buf *TrackedBuffer)
type SpaceSplitExprs ¶
type SpaceSplitExprs []*SpaceSplitExpr
SpaceSplitExprs represents a list of space split expressions.
func (SpaceSplitExprs) Format ¶
func (node SpaceSplitExprs) Format(buf *TrackedBuffer)
type StarExpr ¶
type StarExpr struct {
TableName []byte
}
StarExpr defines a '*' or 'table.*' expression.
func (*StarExpr) Format ¶
func (node *StarExpr) Format(buf *TrackedBuffer)
func (*StarExpr) ISelectExpr ¶
func (*StarExpr) ISelectExpr()
type Statement ¶
type Statement interface { IStatement() SQLNode }
Statement represents a statement.
type StrVal ¶
type StrVal []byte
StrVal represents a string value.
func (StrVal) Format ¶
func (node StrVal) Format(buf *TrackedBuffer)
type Subquery ¶
type Subquery struct {
Select SelectStatement
}
Subquery represents a subquery.
func (*Subquery) Format ¶
func (node *Subquery) Format(buf *TrackedBuffer)
func (*Subquery) ISimpleTableExpr ¶
func (*Subquery) ISimpleTableExpr()
type TableExpr ¶
type TableExpr interface { ITableExpr() SQLNode }
TableExpr represents a table expression.
type TableExprs ¶
type TableExprs []TableExpr
TableExprs represents a list of table expressions.
func (TableExprs) Format ¶
func (node TableExprs) Format(buf *TrackedBuffer)
type TableName ¶
type TableName struct {
Name, Qualifier []byte
}
TableName represents a table name.
func (*TableName) Format ¶
func (node *TableName) Format(buf *TrackedBuffer)
func (*TableName) ISimpleTableExpr ¶
func (*TableName) ISimpleTableExpr()
type Tokenizer ¶
type Tokenizer struct { InStream *strings.Reader AllowComments bool ForceEOF bool Position int LastError string ParseTree Statement // contains filtered or unexported fields }
Tokenizer is the struct used to generate SQL tokens for the parser.
func NewStringTokenizer ¶
NewStringTokenizer creates a new Tokenizer for the sql string.
type TrackedBuffer ¶
TrackedBuffer is used to rebuild a query from the ast. bindLocations keeps track of locations in the buffer that use bind variables for efficient future substitutions. nodeFormatter is the formatting function the buffer will use to format a node. By default(nil), it's FormatNode. But you can supply a different formatting function if you want to generate a query that's different from the default.
func NewTrackedBuffer ¶
func NewTrackedBuffer(nodeFormatter func(buf *TrackedBuffer, node SQLNode)) *TrackedBuffer
NewTrackedBuffer create TrackedBuffer
func (*TrackedBuffer) Fprintf ¶
func (buf *TrackedBuffer) Fprintf(format string, values ...interface{})
Fprintf mimics fmt.Fprintf, but limited to Node(%v), Node.Value(%s) and string(%s). It also allows a %a for a value argument, in which case it adds tracking info for future substitutions.
func (*TrackedBuffer) WriteArg ¶
func (buf *TrackedBuffer) WriteArg(arg string)
WriteArg write argument.
type TransactionStatement ¶
type TransactionStatement interface { IStatement() ITransactionStatement() SQLNode }
TransactionStatement Transaction Statement
type Tuple ¶
type Tuple interface { ITuple() ValExpr }
Tuple represents a tuple. It can be ValTuple, Subquery.
type UnaryExpr ¶
UnaryExpr represents a unary value expression.
func (*UnaryExpr) Format ¶
func (node *UnaryExpr) Format(buf *TrackedBuffer)
type Union ¶
type Union struct { Type string Left, Right SelectStatement }
Union represents a UNION statement.
func (*Union) Format ¶
func (node *Union) Format(buf *TrackedBuffer)
func (*Union) IInsertRows ¶
func (node *Union) IInsertRows()
func (*Union) ISelectStatement ¶
func (node *Union) ISelectStatement()
func (*Union) IStatement ¶
func (node *Union) IStatement()
type Update ¶
type Update struct { Comments Comments Table *TableName Exprs UpdateExprs Where *Where OrderBy OrderBy Limit *Limit }
Update represents an UPDATE statement.
func (*Update) Format ¶
func (node *Update) Format(buf *TrackedBuffer)
func (*Update) IStatement ¶
func (node *Update) IStatement()
type UpdateExpr ¶
UpdateExpr represents an update expression.
func (*UpdateExpr) Format ¶
func (node *UpdateExpr) Format(buf *TrackedBuffer)
type UpdateExprs ¶
type UpdateExprs []*UpdateExpr
UpdateExprs represents a list of update expressions.
func (UpdateExprs) Format ¶
func (node UpdateExprs) Format(buf *TrackedBuffer)
type UseDB ¶
type UseDB struct {
DB string
}
UseDB statement
func (*UseDB) Format ¶
func (node *UseDB) Format(buf *TrackedBuffer)
func (*UseDB) IStatement ¶
func (node *UseDB) IStatement()
type ValArg ¶
type ValArg []byte
ValArg represents a named bind var argument.
func (ValArg) Format ¶
func (node ValArg) Format(buf *TrackedBuffer)
type ValExpr ¶
type ValExpr interface { IValExpr() Expr }
ValExpr represents a value expression.
func CheckColumnInBoolExpr ¶
CheckColumnInBoolExpr check if exists or not. strOrNumValue: if nil, mean no value or has different value.
func CheckColumnInInsertOrReplace ¶
func CheckColumnInInsertOrReplace(columns Columns, insertRows InsertRows, onDup OnDup, colName string) (strOrNumValue ValExpr, err error)
CheckColumnInInsertOrReplace check shard key should exists in columns, not in dup expers, has same shard key's value in rows.
func CheckColumnInSelect ¶
func CheckColumnInSelect(statement SelectStatement, colName string) (strOrNumValue ValExpr, err error)
CheckColumnInSelect check shard key should exists in where and join expression, and has same shard key's value in it.
type ValExprs ¶
type ValExprs []ValExpr
ValExprs represents a list of value expressions. It's not a valid expression because it's not parenthesized.
func (ValExprs) Format ¶
func (node ValExprs) Format(buf *TrackedBuffer)
type ValTuple ¶
type ValTuple ValExprs
ValTuple represents a tuple of actual values.
func (ValTuple) Format ¶
func (node ValTuple) Format(buf *TrackedBuffer)
type Values ¶
type Values []Tuple
Values represents a VALUES clause.
func (Values) Format ¶
func (node Values) Format(buf *TrackedBuffer)
func (Values) IInsertRows ¶
func (Values) IInsertRows()
type When ¶
When represents a WHEN sub-expression.
func (*When) Format ¶
func (node *When) Format(buf *TrackedBuffer)