Documentation
¶
Index ¶
- Constants
- func String(node SQLNode) string
- type AliasedExpr
- type AliasedTableExpr
- type AndExpr
- type ArrayConstructor
- type ArrayElement
- type ArrayElements
- type Begin
- type BeginEnd
- type BinaryExpr
- type BoolVal
- type CaseExpr
- type CastExpr
- type CheckDefinition
- type ColIdent
- type ColName
- type ColTuple
- type CollateExpr
- type ColumnDefinition
- type ColumnKeyOption
- type ColumnType
- type Columns
- type Comment
- type Comments
- type Commit
- type ComparisonExpr
- type ConstraintOptions
- type ConvertExpr
- type ConvertType
- type ConvertUsingExpr
- type Cursor
- type CursorDefinition
- type DDL
- type DDLAction
- type Declare
- type DeclareType
- type Default
- type DefaultDefinition
- type DefaultValueOrExpression
- type Delete
- type ExistsExpr
- type Expr
- type Exprs
- type Extension
- type ForeignKeyDefinition
- type FuncCallExpr
- type FuncExpr
- type GeneratedColumn
- type GroupBy
- type GroupConcatExpr
- type IdentityOpt
- type If
- type IndexColumn
- type IndexColumnsOrExpression
- type IndexDefinition
- type IndexHints
- type IndexInfo
- type IndexOption
- type IndexPartition
- type IndexSpec
- type Insert
- type InsertRows
- type IntervalExpr
- type IsExpr
- type JoinCondition
- type JoinTableExpr
- type LengthScaleOption
- type Limit
- type ListArg
- type LocalVariable
- type MatchExpr
- type NewQualifierColName
- type NextSeqValExpr
- type NotExpr
- type NullVal
- type OnDup
- type OrExpr
- type Order
- type OrderBy
- type OtherAdmin
- type OtherRead
- type OverExpr
- type ParenExpr
- type ParenSelect
- type ParenTableExpr
- type ParserMode
- type Partition
- type PartitionBy
- type PartitionDefinition
- type PartitionSpec
- type Partitions
- type Permissive
- type Policy
- type RangeCond
- type Rollback
- type SQLNode
- type SQLVal
- func NewBitVal(in []byte) *SQLVal
- func NewBoolSQLVal(in bool) *SQLVal
- func NewFloatVal(in []byte) *SQLVal
- func NewHexNum(in []byte) *SQLVal
- func NewHexVal(in []byte) *SQLVal
- func NewIntVal(in []byte) *SQLVal
- func NewStrVal(in []byte) *SQLVal
- func NewUnicodeStrVal(in []byte) *SQLVal
- func NewValArg(in []byte) *SQLVal
- func NewValArgWithOpt(in []byte, opt *SQLVal) *SQLVal
- type Select
- type SelectExpr
- type SelectExprs
- type SelectStatement
- type Sequence
- type Set
- type SetBoolOption
- type SetExpr
- type SetExprs
- type Show
- type ShowFilter
- type ShowTablesOpt
- type SimpleTableExpr
- type SridDefinition
- type StarExpr
- type Statement
- type Stream
- type Subquery
- type SubstrExpr
- type TableExpr
- type TableExprs
- type TableIdent
- type TableName
- type TableNames
- type TableSpec
- type Tokenizer
- type Trigger
- type Type
- type UnaryExpr
- type Union
- type Update
- type UpdateExpr
- type UpdateExprs
- type Use
- type ValTuple
- type ValType
- type Values
- type ValuesFuncExpr
- type View
- type When
- type Where
- type While
Constants ¶
const ( DistinctStr = "distinct " StraightJoinHint = "straight_join " )
Select.Distinct
const ( ForUpdateStr = " for update" )
Select.Lock
const ( SQLCacheStr = "sql_cache " SQLNoCacheStr = "sql_no_cache " )
Select.Cache
const ( UnionStr = "union" UnionAllStr = "union all" UnionDistinctStr = "union distinct" )
Union.Type
const ( InsertStr = "insert" ReplaceStr = "replace" )
DDL strings.
const ( SessionStr = "session" GlobalStr = "global" )
Set.Scope or Show.Scope
const ( AddForeignKey = DDLAction(iota) AddIndex AddPrimaryKey CommentOn CreateExtension CreateIndex CreatePolicy CreateTable CreateTrigger CreateType CreateView )
DDL actions
const ( ViewStr = "view" MaterializedViewStr = "materialized view" SqlSecurityStr = "sql security" )
View types
const ( JoinStr = "join" StraightJoinStr = "straight_join" LeftJoinStr = "left join" RightJoinStr = "right join" NaturalJoinStr = "natural join" NaturalLeftJoinStr = "natural left join" NaturalRightJoinStr = "natural right join" )
JoinTableExpr.Join
const ( UseStr = "use " IgnoreStr = "ignore " ForceStr = "force " )
Index hints.
const ( WhereStr = "where" HavingStr = "having" )
Where.Type
const ( EqualStr = "=" LessThanStr = "<" GreaterThanStr = ">" LessEqualStr = "<=" GreaterEqualStr = ">=" NotEqualStr = "!=" NullSafeEqualStr = "<=>" InStr = "in" NotInStr = "not in" LikeStr = "like" NotLikeStr = "not like" RegexpStr = "regexp" NotRegexpStr = "not regexp" JSONExtractOp = "->" JSONUnquoteExtractOp = "->>" PosixRegexStr = "~" PosixRegexCiStr = "~*" PosixNotRegexStr = "!~" PosixNotRegexCiStr = "!~*" )
ComparisonExpr.Operator
const ( BetweenStr = "between" NotBetweenStr = "not between" )
RangeCond.Operator
const ( IsNullStr = "is null" IsNotNullStr = "is not null" IsTrueStr = "is true" IsNotTrueStr = "is not true" IsFalseStr = "is false" IsNotFalseStr = "is not false" )
IsExpr.Operator
const ( StrVal = ValType(iota) IntVal FloatVal HexNum HexVal ValArg BitVal ValBool UnicodeStrVal )
These are the possible Valtype values. HexNum represents a 0x... value. It cannot be treated as a simple value because it can be interpreted differently depending on the context.
const ( BitAndStr = "&" BitOrStr = "|" BitXorStr = "^" PlusStr = "+" MinusStr = "-" MultStr = "*" DivStr = "/" IntDivStr = "div" ModStr = "%" ShiftLeftStr = "<<" ShiftRightStr = ">>" )
BinaryExpr.Operator
const ( UPlusStr = "+" UMinusStr = "-" TildaStr = "~" BangStr = "!" BinaryStr = "binary " UBinaryStr = "_binary " )
UnaryExpr.Operator
const ( BooleanModeStr = " in boolean mode" NaturalLanguageModeStr = " in natural language mode" NaturalLanguageModeWithQueryExpansionStr = " in natural language mode with query expansion" QueryExpansionStr = " with query expansion" )
MatchExpr.Option
const ( AscScr = "asc" DescScr = "desc" )
Order.Direction and IndexColumn.Direction
const ( OpenStr = "open" CloseStr = "close" DeallocateStr = "deallocate" FetchStr = "fetch" )
const ( ParserModeMysql = ParserMode(iota) ParserModePostgres ParserModeSQLite3 ParserModeMssql )
const ACTION = 57494
const ADD = 57452
const AFTER = 57508
const AGAINST = 57665
const ALL = 57363
const ALLOW_PAGE_LOCKS = 57506
const ALLOW_ROW_LOCKS = 57505
const ALTER = 57448
const ALWAYS = 57677
const ANALYZE = 57451
const AND = 57416
const ANSI_DEFAULTS = 57632
const ANSI_NULLS = 57635
const ANSI_NULL_DFLT_OFF = 57633
const ANSI_NULL_DFLT_ON = 57634
const ANSI_PADDING = 57636
const ANSI_WARNINGS = 57637
const APPROXNUM = 57598
const ARITHABORT = 57627
const ARRAY = 57591
const AS = 57365
const ASC = 57367
const AUTOINCREMENT = 57603
const AUTO_INCREMENT = 57597
const BEFORE = 57507
const BEGIN = 57529
const BETWEEN = 57418
const BIGINT = 57542
const BIGSERIAL = 57543
const BINARY = 57442
const BIT = 57534
const BIT_LITERAL = 57409
const BLOB = 57575
const BOOL = 57563
const BOOLEAN = 57666
const BPCHAR = 57594
const BY = 57358
const CACHE = 57682
const CASCADE = 57492
const CASE = 57419
const CAST = 57656
const CHAR = 57560
const CHARACTER = 57564
const CHARSET = 57611
const CHECK = 57700
const CITEXT = 57574
const CLOSE = 57514
const CLUSTERED = 57686
const COLLATE = 57441
const COLUMN = 57462
const COLUMNSTORE = 57689
const COMMENT = 57407
const COMMENT_KEYWORD = 57408
const COMMIT = 57532
const COMMITTED = 57620
const CONCAT_NULL_YIELDS_NULL = 57624
const CONCURRENTLY = 57526
const CONSTRAINT = 57463
const CONVERT = 57655
const CREATE = 57447
const CROSS = 57392
const CURRENT_DATE = 57647
const CURRENT_TIME = 57648
const CURRENT_TIMESTAMP = 57645
const CURRENT_USER = 57498
const CURSOR = 57512
const CURSOR_CLOSE_ON_COMMIT = 57625
const CYCLE = 57683
const (
CharacterSetStr = " character set"
)
this string is "character set" and this comment is required
const DATABASE = 57646
const DATABASES = 57604
const DATE = 57476
const DATETIME = 57555
const DATETIME2 = 57558
const DATETIMEOFFSET = 57557
const DEALLOCATE = 57519
const DECIMAL = 57549
const DECLARE = 57362
const DEFAULT = 57371
const DEFERRABLE = 57522
const DEFERRED = 57525
const DEFINER = 57697
const DELETE = 57352
const DESC = 57368
const DESCRIBE = 57474
const DISTINCT = 57364
const DIV = 57438
const DOUBLE = 57546
const DROP = 57449
const DUPLICATE = 57370
const EACH = 57509
const ELSE = 57422
const END = 57423
const ENUM = 57581
const ESCAPE = 57477
const EXISTS = 57366
const EXPANSION = 57672
const EXPLAIN = 57475
const EXTENDED = 57607
const FALSE = 57412
const FETCH = 57515
const FILLFACTOR = 57501
const FIRST = 57517
const FLOAT = 57403
const FLOAT_TYPE = 57548
const FMTONLY = 57628
const FOR = 57361
const FORCE = 57395
const FORCEPLAN = 57638
const FOREIGN = 57467
const FROM = 57353
const FULL = 57608
const FULLTEXT = 57466
const GE = 57425
const GENERATED = 57676
const GEOMETRY = 57582
const GEOMETRYCOLLECTION = 57586
const GETDATE = 57593
const GLOBAL = 57612
const GROUP = 57355
const GROUP_CONCAT = 57659
const HAVING = 57356
const HEX = 57399
const HEXNUM = 57404
const HOLDLOCK = 57691
const ID = 57398
const IDENTITY = 57678
const IF = 57460
const IGNORE = 57459
const IGNORE_DUP_KEY = 57502
const IMMEDIATE = 57524
const IMPLICIT_TRANSACTIONS = 57642
const IN = 57431
const INCLUDE = 57690
const INCREMENT = 57680
const INDEX = 57455
const INHERIT = 57661
const INITIALLY = 57523
const INNER = 57390
const INSERT = 57350
const INSTEAD = 57520
const INT = 57539
const INTEGER = 57540
const INTEGRAL = 57402
const INTERVAL = 57444
const INTNUM = 57544
const INTO = 57369
const INVOKER = 57698
const IS = 57428
const ISOLATION = 57614
const JOIN = 57386
const JSON = 57579
const JSONB = 57580
const JSON_EXTRACT_OP = 57445
const JSON_UNQUOTE_EXTRACT_OP = 57446
const KEY = 57472
const KEYS = 57375
const KEY_BLOCK_SIZE = 57468
const LAG = 57663
const LANGUAGE = 57667
const LAST = 57518
const LAST_INSERT_ID = 57379
const LE = 57424
const LEAD = 57662
const LEFT = 57388
const LESS = 57484
const LEVEL = 57615
const LEX_ERROR = 57346
const LIKE = 57429
const LIMIT = 57359
const LINESTRING = 57584
const LIST_ARG = 57406
const LOCALTIME = 57649
const LOCALTIMESTAMP = 57650
const LOCK = 57374
const LONGBLOB = 57578
const LONGTEXT = 57573
const MATCH = 57664
const MATERIALIZED = 57456
const MAX = 57414
const MAXVALUE = 57481
const MEDIUMBLOB = 57577
const MEDIUMINT = 57538
const MEDIUMTEXT = 57572
const MINVALUE = 57681
const MOD = 57439
const MODE = 57383
const MONEY = 57552
const MULTILINESTRING = 57588
const MULTIPOINT = 57587
const MULTIPOLYGON = 57589
const NAMES = 57610
const NATURAL = 57393
const NCHAR = 57566
const NE = 57426
const NEW = 57623
const NEXT = 57380
const NO = 57493
const NOCOUNT = 57629
const NOEXEC = 57630
const NOLOCK = 57692
const NONCLUSTERED = 57687
const NONE = 57685
const NOT = 57417
const NOW = 57592
const NOWAIT = 57693
const NTEXT = 57568
const NULL = 57410
const NULLX = 57596
const NULL_SAFE_EQUAL = 57427
const NUMERIC = 57550
const NUMERIC_ROUNDABORT = 57631
const NVARCHAR = 57567
const OF = 57521
const OFF = 57413
const OFFSET = 57360
const ON = 57396
const ONLY = 57618
const OPEN = 57513
const OPTIMIZE = 57479
const OR = 57415
const ORDER = 57357
const OUTER = 57391
const OVER = 57701
const OWNED = 57684
const PAD_INDEX = 57500
const PAGLOCK = 57694
const PARSER = 57670
const PARTITION = 57482
const PERMISSIVE = 57495
const POINT = 57583
const POLICY = 57469
const POLYGON = 57585
const POSIX_NOT_REGEX = 57434
const POSIX_NOT_REGEX_CI = 57435
const POSIX_REGEX = 57432
const POSIX_REGEX_CI = 57433
const PRECISION = 57547
const PRIMARY = 57461
const PRIOR = 57516
const PROCEDURE = 57486
const PROCESSLIST = 57609
const PUBLIC = 57497
const QUERY = 57671
const QUOTED_IDENTIFIER = 57626
const READ = 57616
const REAL = 57545
const REFERENCES = 57464
const REGEXP = 57430
const REMOTE_PROC_TRANSACTIONS = 57643
const RENAME = 57450
const REORGANIZE = 57483
const REPAIR = 57478
const REPEATABLE = 57619
const REPLACE = 57654
const REPLICATION = 57688
const RESTRICT = 57491
const RESTRICTIVE = 57496
const RIGHT = 57389
const ROLLBACK = 57533
const ROW = 57510
const ROWID = 57376
const ROWLOCK = 57695
const (
ReorganizeStr = "reorganize partition"
)
Partition strings
const SCHEMA = 57453
const SCROLL = 57511
const SECURITY = 57528
const SELECT = 57348
const SEPARATOR = 57660
const SEQUENCE = 57679
const SERIAL = 57541
const SERIALIZABLE = 57622
const SESSION = 57613
const SESSION_USER = 57499
const SET = 57373
const SHARE = 57382
const SHIFT_LEFT = 57436
const SHIFT_RIGHT = 57437
const SHOW = 57473
const SHOWPLAN_ALL = 57639
const SHOWPLAN_TEXT = 57640
const SHOWPLAN_XML = 57641
const SIGNED = 57599
const SMALLDATETIME = 57559
const SMALLINT = 57536
const SMALLMONEY = 57551
const SMALLSERIAL = 57537
const SPATIAL = 57465
const SQL = 57527
const SQL_CACHE = 57385
const SQL_NO_CACHE = 57384
const SRID = 57372
const START = 57530
const STATISTICS_INCREMENTAL = 57504
const STATISTICS_NORECOMPUTE = 57503
const STATUS = 57489
const STORED = 57675
const STRAIGHT_JOIN = 57387
const STREAM = 57349
const STRICT = 57377
const STRING = 57400
const SUBSTR = 57657
const SUBSTRING = 57658
const TABLE = 57454
const TABLELOCK = 57696
const TABLES = 57605
const TEXT = 57570
const TEXT_PATTERN_OPS = 57595
const THAN = 57485
const THEN = 57421
const TIME = 57553
const TIMESTAMP = 57554
const TINYBLOB = 57576
const TINYINT = 57535
const TINYTEXT = 57571
const TO = 57458
const TRANSACTION = 57531
const TRIGGER = 57487
const TRUE = 57411
const TRUNCATE = 57480
const TYPE = 57488
const TYPECAST = 57699
const UNARY = 57440
const UNCOMMITTED = 57621
const UNDERSCORE_BINARY = 57443
const UNICODE_STRING = 57401
const UNION = 57347
const UNIQUE = 57471
const UNSIGNED = 57600
const UNUSED = 57673
const UPDATE = 57351
const USE = 57394
const USING = 57397
const UTC_DATE = 57651
const UTC_TIME = 57652
const UTC_TIMESTAMP = 57653
const UUID = 57569
const VALUE = 57381
const VALUES = 57378
const VALUE_ARG = 57405
const VARBINARY = 57565
const VARCHAR = 57561
const VARIABLES = 57490
const VARIADIC = 57590
const VARYING = 57562
const VIEW = 57457
const VIRTUAL = 57674
const VSCHEMA_TABLES = 57606
const WHEN = 57420
const WHERE = 57354
const WHILE = 57470
const WITH = 57668
const WITHOUT = 57669
const WRITE = 57617
const XACT_ABORT = 57644
const YEAR = 57556
const ZEROFILL = 57601
const ZONE = 57602
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AliasedExpr ¶
AliasedExpr defines an aliased SELECT expression.
func (*AliasedExpr) Format ¶
func (node *AliasedExpr) Format(buf *nodeBuffer)
Format formats the node.
type AliasedTableExpr ¶
type AliasedTableExpr struct {
Expr SimpleTableExpr
Partitions Partitions
As TableIdent
TableHints []string
IndexHints *IndexHints
}
AliasedTableExpr represents a table expression coupled with an optional alias or index hint. If As is empty, no alias was used.
func (*AliasedTableExpr) Format ¶
func (node *AliasedTableExpr) Format(buf *nodeBuffer)
Format formats the node.
type ArrayConstructor ¶
type ArrayConstructor struct {
Elements ArrayElements
}
func (*ArrayConstructor) Format ¶
func (node *ArrayConstructor) Format(buf *nodeBuffer)
type ArrayElement ¶
type ArrayElement interface {
SQLNode
// contains filtered or unexported methods
}
type ArrayElements ¶
type ArrayElements []ArrayElement
func (ArrayElements) Format ¶
func (node ArrayElements) Format(buf *nodeBuffer)
type BinaryExpr ¶
BinaryExpr represents a binary value expression.
func (*BinaryExpr) Format ¶
func (node *BinaryExpr) Format(buf *nodeBuffer)
Format formats the node.
type CheckDefinition ¶
type ColIdent ¶
type ColIdent struct {
// contains filtered or unexported fields
}
ColIdent is a case insensitive SQL identifier. It will be escaped with backquotes if necessary.
type ColName ¶
type ColName struct {
// Metadata is not populated by the parser.
// It's a placeholder for analyzers to store
// additional data, typically info about which
// table or column this node references.
Metadata interface{}
Name ColIdent
Qualifier TableName
}
ColName represents a column name.
type ColTuple ¶
type ColTuple interface {
Expr
// contains filtered or unexported methods
}
ColTuple represents a list of column values. It can be ValTuple, Subquery, ListArg.
type CollateExpr ¶
CollateExpr represents dynamic collate operator.
func (*CollateExpr) Format ¶
func (node *CollateExpr) Format(buf *nodeBuffer)
Format formats the node.
type ColumnDefinition ¶
type ColumnDefinition struct {
Name ColIdent
Type ColumnType
}
ColumnDefinition describes a column in a CREATE TABLE statement
func (*ColumnDefinition) Format ¶
func (col *ColumnDefinition) Format(buf *nodeBuffer)
Format formats the node.
type ColumnKeyOption ¶
type ColumnKeyOption int
ColumnKeyOption indicates whether or not the given column is defined as an index element and contains the type of the option
type ColumnType ¶
type ColumnType struct {
// The base type string
Type string
// Generic field options.
NotNull *BoolVal
Autoincrement BoolVal
Default *DefaultDefinition
Srid *SridDefinition
OnUpdate *SQLVal
Comment *SQLVal
Check *CheckDefinition
Array BoolVal
// Numeric field options
Length *SQLVal
Unsigned BoolVal
Zerofill BoolVal
Scale *SQLVal
DisplayWidth *SQLVal
// Text field options
Charset string
Collate string
// Timestamp field options
Timezone BoolVal
// Enum values
EnumValues []string
// Key specification
KeyOpt ColumnKeyOption
References string
ReferenceNames Columns
ReferenceOnDelete ColIdent
ReferenceOnUpdate ColIdent
// MySQL: GENERATED ALWAYS AS (expr)
Generated *GeneratedColumn
// PostgreSQL: GENERATED AS IDENTITY
Identity *IdentityOpt
}
ColumnType represents a sql type in a CREATE TABLE statement All optional fields are nil if not specified
func (*ColumnType) Format ¶
func (ct *ColumnType) Format(buf *nodeBuffer)
Format returns a canonical string representation of the type and all relevant options
type ComparisonExpr ¶
ComparisonExpr represents a two-value comparison expression.
func (*ComparisonExpr) Format ¶
func (node *ComparisonExpr) Format(buf *nodeBuffer)
Format formats the node.
type ConstraintOptions ¶
type ConvertExpr ¶
type ConvertExpr struct {
Expr Expr
Type *ConvertType
}
ConvertExpr represents a call to CONVERT(expr, type) or it's equivalent CAST(expr AS type). Both are rewritten to the former.
func (*ConvertExpr) Format ¶
func (node *ConvertExpr) Format(buf *nodeBuffer)
type ConvertType ¶
ConvertType represents the type in call to CONVERT(expr, type)
func (*ConvertType) Format ¶
func (node *ConvertType) Format(buf *nodeBuffer)
Format formats the node.
type ConvertUsingExpr ¶
ConvertUsingExpr represents a call to CONVERT(expr USING charset).
func (*ConvertUsingExpr) Format ¶
func (node *ConvertUsingExpr) Format(buf *nodeBuffer)
type CursorDefinition ¶
type CursorDefinition struct {
Name ColIdent
Scroll bool
Select SelectStatement
}
func (*CursorDefinition) Format ¶
func (node *CursorDefinition) Format(buf *nodeBuffer)
type DDL ¶
type DDL struct {
Action DDLAction
Table TableName
NewName TableName
IfExists bool
TableSpec *TableSpec
PartitionSpec *PartitionSpec
IndexSpec *IndexSpec
IndexCols []IndexColumn
IndexExpr Expr
ForeignKey *ForeignKeyDefinition
Policy *Policy
View *View
Trigger *Trigger
Type *Type
Comment *Comment
Extension *Extension
}
DDL represents a CREATE, ALTER, DROP, RENAME or TRUNCATE statement. Table is set for AlterStr, DropStr, RenameStr, TruncateTable NewName is set for AlterStr, CreateStr, RenameStr.
type Declare ¶
type Declare struct {
Type DeclareType
Variables []*LocalVariable
Cursor *CursorDefinition
}
type DeclareType ¶
type DeclareType int
type DefaultDefinition ¶
type DefaultDefinition struct {
ValueOrExpression DefaultValueOrExpression
ConstraintName ColIdent // only for MSSQL
}
type Delete ¶
type Delete struct {
Comments Comments
Targets TableNames
TableExprs TableExprs
Partitions Partitions
Where *Where
OrderBy OrderBy
Limit *Limit
}
Delete represents a DELETE statement. If you add fields here, consider adding them to calls to validateSubquerySamePlan.
type ExistsExpr ¶
type ExistsExpr struct {
Subquery *Subquery
}
ExistsExpr represents an EXISTS expression.
func (*ExistsExpr) Format ¶
func (node *ExistsExpr) Format(buf *nodeBuffer)
Format formats the node.
type Expr ¶
type Expr interface {
SQLNode
// contains filtered or unexported methods
}
Expr represents an expression.
type Exprs ¶
type Exprs []Expr
Exprs represents a list of value expressions. It's not a valid expression because it's not parenthesized.
type ForeignKeyDefinition ¶
type FuncCallExpr ¶
FuncCallExpr represents a function call that takes Exprs.
func (*FuncCallExpr) Format ¶
func (node *FuncCallExpr) Format(buf *nodeBuffer)
type FuncExpr ¶
type FuncExpr struct {
Qualifier TableIdent
Name ColIdent
Distinct bool
Exprs SelectExprs
Over *OverExpr
}
FuncExpr represents a function call that takes SelectExprs.
type GeneratedColumn ¶
type GroupConcatExpr ¶
type GroupConcatExpr struct {
Distinct string
Exprs SelectExprs
OrderBy OrderBy
Separator string
}
GroupConcatExpr represents a call to GROUP_CONCAT
func (*GroupConcatExpr) Format ¶
func (node *GroupConcatExpr) Format(buf *nodeBuffer)
Format formats the node
type IdentityOpt ¶
type If ¶
type IndexColumn ¶
IndexColumn describes a column in an index definition with optional length
type IndexColumnsOrExpression ¶
type IndexColumnsOrExpression struct {
IndexCols []IndexColumn
IndexExpr Expr
}
type IndexDefinition ¶
type IndexDefinition struct {
Info *IndexInfo
Columns []IndexColumn
Options []*IndexOption
Partition *IndexPartition
ConstraintOptions *ConstraintOptions
}
IndexDefinition describes an index in a CREATE TABLE statement
func (*IndexDefinition) Format ¶
func (idx *IndexDefinition) Format(buf *nodeBuffer)
Format formats the node.
type IndexHints ¶
IndexHints represents a list of index hints.
func (*IndexHints) Format ¶
func (node *IndexHints) Format(buf *nodeBuffer)
Format formats the node.
type IndexInfo ¶
type IndexInfo struct {
Type string
Name ColIdent
Primary bool
Spatial bool
Unique bool
Fulltext bool
Clustered BoolVal
}
IndexInfo describes the name and type of an index in a CREATE TABLE statement
type IndexOption ¶
IndexOption is used for trailing options for indexes: COMMENT, KEY_BLOCK_SIZE, USING
type IndexPartition ¶
type IndexSpec ¶
type IndexSpec struct {
Name ColIdent
Type ColIdent
Unique bool
Primary bool
Constraint bool
Clustered bool // for MSSQL
ColumnStore bool // for MSSQL
Included []ColIdent
Where *Where
Options []*IndexOption
Partition *IndexPartition // for MSSQL
ConstraintOptions *ConstraintOptions
}
type Insert ¶
type Insert struct {
Action string
Comments Comments
Ignore string
Table TableName
Partitions Partitions
Columns Columns
Rows InsertRows
OnDup OnDup
}
Insert represents an INSERT or REPLACE statement. Per the MySQL docs, http://dev.mysql.com/doc/refman/5.7/en/replace.html Replace is the counterpart to `INSERT IGNORE`, and works exactly like a normal INSERT except if the row exists. In that case it first deletes the row and re-inserts with new values. For that reason we keep it as an Insert struct. Replaces are currently disallowed in sharded schemas because of the implications the deletion part may have on the original parser. If you add fields here, consider adding them to calls to validateSubquerySamePlan.
type InsertRows ¶
type InsertRows interface {
SQLNode
// contains filtered or unexported methods
}
InsertRows represents the rows for an INSERT statement.
type IntervalExpr ¶
IntervalExpr represents a date-time INTERVAL expression.
func (*IntervalExpr) Format ¶
func (node *IntervalExpr) Format(buf *nodeBuffer)
Format formats the node.
type JoinCondition ¶
JoinCondition represents the join conditions (either a ON or USING clause) of a JoinTableExpr.
func (JoinCondition) Format ¶
func (node JoinCondition) Format(buf *nodeBuffer)
Format formats the node.
type JoinTableExpr ¶
type JoinTableExpr struct {
LeftExpr TableExpr
Join string
RightExpr TableExpr
Condition JoinCondition
}
JoinTableExpr represents a TableExpr that's a JOIN operation.
func (*JoinTableExpr) Format ¶
func (node *JoinTableExpr) Format(buf *nodeBuffer)
Format formats the node.
type LengthScaleOption ¶
LengthScaleOption is used for types that have an optional length and scale
type LocalVariable ¶
type LocalVariable struct {
Name ColIdent
DataType ColumnType
}
func (*LocalVariable) Format ¶
func (node *LocalVariable) Format(buf *nodeBuffer)
type MatchExpr ¶
type MatchExpr struct {
Columns SelectExprs
Expr Expr
Option string
}
MatchExpr represents a call to the MATCH function
type NewQualifierColName ¶
type NewQualifierColName struct {
Name ColIdent
}
NewQualifierColName represents a column name with NEW qualifier.
func (*NewQualifierColName) Format ¶
func (node *NewQualifierColName) Format(buf *nodeBuffer)
Format formats the node.
type NextSeqValExpr ¶
type NextSeqValExpr struct {
SequenceName TableIdent
}
NextSeqVal represents a NEXT VALUE FOR expression in SQL Server.
func (*NextSeqValExpr) Format ¶
func (node *NextSeqValExpr) Format(buf *nodeBuffer)
Format formats the node.
type OtherAdmin ¶
type OtherAdmin struct{}
OtherAdmin represents a misc statement that relies on ADMIN privileges, such as REPAIR, OPTIMIZE, or TRUNCATE statement. It should be used only as an indicator. It does not contain the full AST for the statement.
func (*OtherAdmin) Format ¶
func (node *OtherAdmin) Format(buf *nodeBuffer)
Format formats the node.
type OtherRead ¶
type OtherRead struct{}
OtherRead represents a DESCRIBE, or EXPLAIN statement. It should be used only as an indicator. It does not contain the full AST for the statement.
type OverExpr ¶
type OverExpr struct {
PartitionBy PartitionBy
OrderBy OrderBy
}
OverExpr represents a call to OVER
type ParenExpr ¶
type ParenExpr struct {
Expr Expr
}
ParenExpr represents a parenthesized boolean expression.
type ParenSelect ¶
type ParenSelect struct {
Select SelectStatement
}
ParenSelect is a parenthesized SELECT statement.
func (*ParenSelect) Format ¶
func (node *ParenSelect) Format(buf *nodeBuffer)
Format formats the node.
type ParenTableExpr ¶
type ParenTableExpr struct {
Exprs TableExprs
}
ParenTableExpr represents a parenthesized list of TableExpr.
func (*ParenTableExpr) Format ¶
func (node *ParenTableExpr) Format(buf *nodeBuffer)
Format formats the node.
type ParserMode ¶
type ParserMode int
type PartitionBy ¶
type PartitionBy []*Partition
PartitionBy represents a PARTITON BY clause.
func (PartitionBy) Format ¶
func (node PartitionBy) Format(buf *nodeBuffer)
Format formats the node.
type PartitionDefinition ¶
PartitionDefinition describes a very minimal partition definition
func (*PartitionDefinition) Format ¶
func (node *PartitionDefinition) Format(buf *nodeBuffer)
Format formats the node
type PartitionSpec ¶
type PartitionSpec struct {
Action string
Name ColIdent
Definitions []*PartitionDefinition
}
PartitionSpec describe partition actions (for alter and create)
func (*PartitionSpec) Format ¶
func (node *PartitionSpec) Format(buf *nodeBuffer)
Format formats the node.
type Partitions ¶
type Partitions Columns
Partitions is a type alias for Columns so we can handle printing efficiently
type Permissive ¶
type Permissive string
type SQLNode ¶
type SQLNode interface {
Format(buf *nodeBuffer)
}
SQLNode defines the interface for all nodes generated by the parser.
type SQLVal ¶
SQLVal represents a single value.
func NewBoolSQLVal ¶
func NewUnicodeStrVal ¶
NewUnicode bulds a new UniodeStrVal.
func NewValArgWithOpt ¶
type Select ¶
type Select struct {
Cache string
Comments Comments
Distinct string
Hints string
SelectExprs SelectExprs
From TableExprs
Where *Where
GroupBy GroupBy
Having *Where
OrderBy OrderBy
Limit *Limit
Lock string
}
Select represents a SELECT statement.
type SelectExpr ¶
type SelectExpr interface {
SQLNode
// contains filtered or unexported methods
}
SelectExpr represents a SELECT expression.
type SelectExprs ¶
type SelectExprs []SelectExpr
SelectExprs represents SELECT expressions.
func (SelectExprs) Format ¶
func (node SelectExprs) Format(buf *nodeBuffer)
Format formats the node.
type SelectStatement ¶
type SelectStatement interface {
SQLNode
// contains filtered or unexported methods
}
SelectStatement any SELECT statement.
type SetBoolOption ¶
SetOption represents a SET statement that specifies option in SQL Server.
func (*SetBoolOption) Format ¶
func (node *SetBoolOption) Format(buf *nodeBuffer)
Format formats the node.
type Show ¶
type Show struct {
Type string
OnTable TableName
ShowTablesOpt *ShowTablesOpt
Scope string
}
Show represents a show statement.
type ShowFilter ¶
ShowFilter is show tables filter
func (*ShowFilter) Format ¶
func (node *ShowFilter) Format(buf *nodeBuffer)
Format formats the node.
type ShowTablesOpt ¶
type ShowTablesOpt struct {
Extended string
Full string
DbName string
Filter *ShowFilter
}
ShowTablesOpt is show tables option
type SimpleTableExpr ¶
type SimpleTableExpr interface {
SQLNode
// contains filtered or unexported methods
}
SimpleTableExpr represents a simple table expression.
type SridDefinition ¶
type SridDefinition struct {
Value *SQLVal
}
type StarExpr ¶
type StarExpr struct {
TableName TableName
}
StarExpr defines a '*' or 'table.*' expression.
type Statement ¶
type Statement interface {
SQLNode
// contains filtered or unexported methods
}
Statement represents a statement.
type Stream ¶
type Stream struct {
Comments Comments
SelectExpr SelectExpr
Table TableName
}
Stream represents a SELECT statement.
type SubstrExpr ¶
SubstrExpr represents a call to SubstrExpr(column, value_expression) or SubstrExpr(column, value_expression,value_expression) also supported syntax SubstrExpr(column from value_expression for value_expression)
func (*SubstrExpr) Format ¶
func (node *SubstrExpr) Format(buf *nodeBuffer)
Format formats the node.
type TableExpr ¶
type TableExpr interface {
SQLNode
// contains filtered or unexported methods
}
TableExpr represents a table expression.
type TableIdent ¶
type TableIdent struct {
// contains filtered or unexported fields
}
TableIdent is a case sensitive SQL identifier. Escaped by Format() if necessary.
func NewTableIdent ¶
func NewTableIdent(str string) TableIdent
NewTableIdent creates a new TableIdent.
func (TableIdent) String ¶
func (node TableIdent) String() string
String returns the unescaped table name. It must not be used for SQL generation. Use parser.String instead. The Stringer conformance is for usage in templates.
type TableName ¶
type TableName struct {
Schema TableIdent
Name TableIdent
}
TableName represents a table name: [Name] or [Schema].[Name]
type TableSpec ¶
type TableSpec struct {
Columns []*ColumnDefinition
Indexes []*IndexDefinition
ForeignKeys []*ForeignKeyDefinition
Checks []*CheckDefinition
Options map[string]string
}
TableSpec describes the structure of a table from a CREATE TABLE statement
type Tokenizer ¶
type Tokenizer struct {
InStream io.Reader
AllowComments bool
ForceEOF bool
Position int
LastError error
ParseTree Statement
// contains filtered or unexported fields
}
Tokenizer is the struct used to generate SQL tokens for the parser.
func NewTokenizer ¶
func NewTokenizer(sql string, mode ParserMode) *Tokenizer
NewTokenizer creates a new Tokenizer for a given SQL string.
type Type ¶
type Type struct {
Name TableName // workaround: using TableName to handle schema
Type ColumnType
}
type Union ¶
type Union struct {
Type string
Left, Right SelectStatement
OrderBy OrderBy
Limit *Limit
Lock string
}
Union represents a UNION statement.
type Update ¶
type Update struct {
Comments Comments
TableExprs TableExprs
Exprs UpdateExprs
Where *Where
OrderBy OrderBy
Limit *Limit
}
Update represents an UPDATE statement. If you add fields here, consider adding them to calls to validateSubquerySamePlan.
type UpdateExpr ¶
UpdateExpr represents an update expression.
func (*UpdateExpr) Format ¶
func (node *UpdateExpr) Format(buf *nodeBuffer)
Format formats the node.
type UpdateExprs ¶
type UpdateExprs []*UpdateExpr
UpdateExprs represents a list of update expressions.
func (UpdateExprs) Format ¶
func (node UpdateExprs) Format(buf *nodeBuffer)
Format formats the node.
type ValuesFuncExpr ¶
type ValuesFuncExpr struct {
Name *ColName
}
ValuesFuncExpr represents a function call.
func (*ValuesFuncExpr) Format ¶
func (node *ValuesFuncExpr) Format(buf *nodeBuffer)
Format formats the node.
type View ¶
type View struct {
Type string
SecurityType string
Name TableName
Definition SelectStatement
}