Documentation ¶
Index ¶
- Constants
- Variables
- func AsInterface(node ValExpr) (interface{}, error)
- func EncodeValue(buf *bytes.Buffer, value interface{}) error
- func FetchBindVar(name string, bindVariables map[string]interface{}) (val interface{}, isList bool, err error)
- func GetColName(node Expr) string
- func GetTableName(node SimpleTableExpr) string
- func HasINClause(conditions []BoolExpr) bool
- func IsColName(node ValExpr) bool
- func IsNull(node ValExpr) bool
- func IsSimpleTuple(node ValExpr) bool
- func IsValue(node ValExpr) bool
- func String(node SQLNode) string
- func StringIn(str string, values ...string) bool
- func Walk(visit Visit, nodes ...SQLNode) error
- type AliasedTableExpr
- type AndExpr
- type BinaryExpr
- type BoolExpr
- type BoolVal
- type CaseExpr
- type ColName
- type ColTuple
- type Columns
- type Comments
- type ComparisonExpr
- type DDL
- type Delete
- type ExistsExpr
- type Expr
- type FuncExpr
- type GroupBy
- type IndexHints
- type Insert
- type InsertRows
- type IntervalExpr
- type IsExpr
- type JoinTableExpr
- type KeyrangeExpr
- type Limit
- type ListArg
- type Nextval
- type NonStarExpr
- type NotExpr
- type NullVal
- type NumVal
- type OnDup
- type OrExpr
- type Order
- type OrderBy
- type Other
- type ParenBoolExpr
- type ParenTableExpr
- type ParsedQuery
- type RangeCond
- type RowTuple
- type SQLName
- type SQLNode
- type Select
- type SelectExpr
- type SelectExprs
- type SelectStatement
- type Set
- type SimpleTableExpr
- type StarExpr
- type Statement
- type StrVal
- type Subquery
- type TableExpr
- type TableExprs
- type TableName
- type Tokenizer
- type TrackedBuffer
- type TupleEqualityList
- type UnaryExpr
- type Union
- type Update
- type UpdateExpr
- type UpdateExprs
- type ValArg
- type ValExpr
- type ValExprs
- type ValTuple
- type Values
- type Visit
- type When
- type Where
Constants ¶
const ( ForUpdateStr = " for update" )
Select.Lock
const ( UnionStr = "union" UnionAllStr = "union all" SetMinusStr = "minus" ExceptStr = "except" IntersectStr = "intersect" )
Union.Type
const ( CreateStr = "create" AlterStr = "alter" DropStr = "drop" RenameStr = "rename" )
DDL strings.
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" )
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 ( BitAndStr = "&" BitOrStr = "|" BitXorStr = "^" PlusStr = "+" MinusStr = "-" MultStr = "*" DivStr = "/" ModStr = "%" ShiftLeftStr = "<<" ShiftRightStr = ">>" )
BinaryExpr.Operator
const ( UPlusStr = '+' UMinusStr = '-' TildaStr = '~' )
UnaryExpr.Operator
const ( AscScr = "asc" DescScr = "desc" )
Order.Direction
const ALL = 57363
const ALTER = 57422
const ANALYZE = 57425
const AND = 57401
const AS = 57365
const ASC = 57367
const BETWEEN = 57403
const BY = 57360
const CASE = 57404
const COMMENT = 57396
const CREATE = 57421
const CROSS = 57386
const DEFAULT = 57372
const DELETE = 57354
const DESC = 57368
const DESCRIBE = 57435
const DISTINCT = 57364
const DROP = 57423
const DUPLICATE = 57370
const (
DistinctStr = "distinct "
)
Select.Distinct
const ELSE = 57407
const END = 57420
const EXCEPT = 57349
const EXISTS = 57366
const EXPLAIN = 57436
const FALSE = 57399
const FOR = 57362
const FORCE = 57389
const FROM = 57355
const GE = 57409
const GROUP = 57357
const HAVING = 57358
const ID = 57391
const IF = 57431
const IGNORE = 57430
const IN = 57415
const INDEX = 57427
const INNER = 57384
const INSERT = 57352
const INTERSECT = 57350
const INTERVAL = 57419
const INTO = 57369
const IS = 57412
const JOIN = 57380
const KEY = 57371
const KEYRANGE = 57375
const LAST_INSERT_ID = 57377
const LE = 57408
const LEFT = 57382
const LEX_ERROR = 57346
const LIKE = 57413
const LIMIT = 57361
const LIST_ARG = 57395
const LOCK = 57374
const MINUS = 57348
const NATURAL = 57387
const NE = 57410
const NEXT = 57378
const NOT = 57402
const NULL = 57397
const NULL_SAFE_EQUAL = 57411
const NUMBER = 57393
const ON = 57390
const OR = 57400
const ORDER = 57359
const OUTER = 57385
const REGEXP = 57414
const RENAME = 57424
const RIGHT = 57383
const SELECT = 57351
const SET = 57373
const SHIFT_LEFT = 57416
const SHIFT_RIGHT = 57417
const SHOW = 57434
const STRAIGHT_JOIN = 57381
const STRING = 57392
const TABLE = 57426
const THEN = 57406
const TO = 57429
const TRUE = 57398
const UNARY = 57418
const UNION = 57347
const UNIQUE = 57432
const UPDATE = 57353
const USE = 57388
const USING = 57433
const VALUE = 57379
const VALUES = 57376
const VALUE_ARG = 57394
const VIEW = 57428
const WHEN = 57405
const WHERE = 57356
Variables ¶
var Aggregates = map[string]bool{ "avg": true, "bit_and": true, "bit_or": true, "bit_xor": true, "count": true, "group_concat": true, "max": true, "min": true, "std": true, "stddev_pop": true, "stddev_samp": true, "stddev": true, "sum": true, "var_pop": true, "var_samp": true, "variance": true, }
Aggregates is a map of all aggregate functions.
Functions ¶
func AsInterface ¶
AsInterface converts the ValExpr to an interface. It converts ValTuple to []interface{}, ValArg to string, StrVal to sqltypes.String, NumVal to sqltypes.Numeric, NullVal to nil. Otherwise, it returns an error.
func EncodeValue ¶
EncodeValue encodes one bind variable value into the query.
func FetchBindVar ¶
func FetchBindVar(name string, bindVariables map[string]interface{}) (val interface{}, isList bool, err error)
FetchBindVar resolves the bind variable by fetching it from bindVariables.
func GetColName ¶
GetColName returns the column name, only if it's a simple expression. Otherwise, it returns "".
func GetTableName ¶
func GetTableName(node SimpleTableExpr) string
GetTableName returns the table name from the SimpleTableExpr only if it's a simple expression. Otherwise, it returns "".
func HasINClause ¶
HasINClause returns true if any of the conditions has an IN clause.
func IsSimpleTuple ¶
IsSimpleTuple returns true if the ValExpr is a ValTuple that contains simple values or if it's a list arg.
func IsValue ¶
IsValue returns true if the ValExpr is a string, number or value arg. NULL is not considered to be a value.
Types ¶
type AliasedTableExpr ¶
type AliasedTableExpr struct { Expr SimpleTableExpr As SQLName Hints *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 *TrackedBuffer)
Format formats the node.
func (*AliasedTableExpr) WalkSubtree ¶
func (node *AliasedTableExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type AndExpr ¶
type AndExpr struct {
Left, Right BoolExpr
}
AndExpr represents an AND expression.
func (*AndExpr) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type BinaryExpr ¶
BinaryExpr represents a binary value expression.
func (*BinaryExpr) Format ¶
func (node *BinaryExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*BinaryExpr) WalkSubtree ¶
func (node *BinaryExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type BoolExpr ¶
type BoolExpr interface { Expr // contains filtered or unexported methods }
BoolExpr represents a boolean expression.
type BoolVal ¶
type BoolVal bool
BoolVal is true or false.
func (BoolVal) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type CaseExpr ¶
CaseExpr represents a CASE expression.
func (*CaseExpr) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
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 SQLName Qualifier SQLName }
ColName represents a column name.
func (*ColName) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type ColTuple ¶
type ColTuple interface { ValExpr // contains filtered or unexported methods }
ColTuple represents a list of column values. It can be ValTuple, Subquery, ListArg.
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) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Comments ¶
type Comments [][]byte
Comments represents a list of comments.
func (Comments) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type ComparisonExpr ¶
ComparisonExpr represents a two-value comparison expression.
func (*ComparisonExpr) Format ¶
func (node *ComparisonExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*ComparisonExpr) WalkSubtree ¶
func (node *ComparisonExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type DDL ¶
DDL represents a CREATE, ALTER, DROP or RENAME statement. Table is set for AlterStr, DropStr, RenameStr. NewName is set for AlterStr, CreateStr, RenameStr.
func (*DDL) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Delete ¶
Delete represents a DELETE statement.
func (*Delete) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type ExistsExpr ¶
type ExistsExpr struct {
Subquery *Subquery
}
ExistsExpr represents an EXISTS expression.
func (*ExistsExpr) Format ¶
func (node *ExistsExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*ExistsExpr) WalkSubtree ¶
func (node *ExistsExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type Expr ¶
type Expr interface { SQLNode // contains filtered or unexported methods }
Expr represents an expression.
type FuncExpr ¶
type FuncExpr struct { Name string Distinct bool Exprs SelectExprs }
FuncExpr represents a function call.
func (*FuncExpr) IsAggregate ¶
IsAggregate returns true if the function is an aggregate.
func (*FuncExpr) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type GroupBy ¶
type GroupBy []ValExpr
GroupBy represents a GROUP BY clause.
func (GroupBy) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type IndexHints ¶
IndexHints represents a list of index hints.
func (*IndexHints) Format ¶
func (node *IndexHints) Format(buf *TrackedBuffer)
Format formats the node.
func (*IndexHints) WalkSubtree ¶
func (node *IndexHints) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type Insert ¶
type Insert struct { Comments Comments Ignore string Table *TableName Columns Columns Rows InsertRows OnDup OnDup }
Insert represents an INSERT statement.
func (*Insert) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
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 *TrackedBuffer)
Format formats the node.
func (*IntervalExpr) WalkSubtree ¶
func (node *IntervalExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type IsExpr ¶
IsExpr represents an IS ... or an IS NOT ... expression.
func (*IsExpr) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type JoinTableExpr ¶
JoinTableExpr represents a TableExpr that's a JOIN operation.
func (*JoinTableExpr) Format ¶
func (node *JoinTableExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*JoinTableExpr) WalkSubtree ¶
func (node *JoinTableExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type KeyrangeExpr ¶
type KeyrangeExpr struct {
Start, End ValExpr
}
KeyrangeExpr represents a KEYRANGE expression.
func (*KeyrangeExpr) Format ¶
func (node *KeyrangeExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*KeyrangeExpr) WalkSubtree ¶
func (node *KeyrangeExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type Limit ¶
type Limit struct {
Offset, Rowcount ValExpr
}
Limit represents a LIMIT clause.
func (*Limit) Limits ¶
Limits returns the values of the LIMIT clause as interfaces. The returned values can be nil for absent field, string for bind variable names, or int64 for an actual number. Otherwise, it's an error.
func (*Limit) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type ListArg ¶
type ListArg []byte
ListArg represents a named list argument.
func (ListArg) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Nextval ¶
type Nextval struct{}
Nextval defines the NEXT VALUE expression.
func (Nextval) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type NonStarExpr ¶
NonStarExpr defines a non-'*' select expr.
func (*NonStarExpr) Format ¶
func (node *NonStarExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*NonStarExpr) WalkSubtree ¶
func (node *NonStarExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type NotExpr ¶
type NotExpr struct {
Expr BoolExpr
}
NotExpr represents a NOT expression.
func (*NotExpr) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type NullVal ¶
type NullVal struct{}
NullVal represents a NULL value.
func (*NullVal) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type NumVal ¶
type NumVal []byte
NumVal represents a number.
func (NumVal) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type OnDup ¶
type OnDup UpdateExprs
OnDup represents an ON DUPLICATE KEY clause.
func (OnDup) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type OrExpr ¶
type OrExpr struct {
Left, Right BoolExpr
}
OrExpr represents an OR expression.
func (*OrExpr) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Order ¶
Order represents an ordering expression.
func (*Order) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type OrderBy ¶
type OrderBy []*Order
OrderBy represents an ORDER By clause.
func (OrderBy) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Other ¶
type Other struct{}
Other represents a SHOW, DESCRIBE, or EXPLAIN statement. It should be used only as an indicator. It does not contain the full AST for the statement.
func (*Other) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type ParenBoolExpr ¶
type ParenBoolExpr struct {
Expr BoolExpr
}
ParenBoolExpr represents a parenthesized boolean expression.
func (*ParenBoolExpr) Format ¶
func (node *ParenBoolExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*ParenBoolExpr) WalkSubtree ¶
func (node *ParenBoolExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type ParenTableExpr ¶
type ParenTableExpr struct {
Exprs TableExprs
}
ParenTableExpr represents a parenthesized list of TableExpr.
func (*ParenTableExpr) Format ¶
func (node *ParenTableExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*ParenTableExpr) WalkSubtree ¶
func (node *ParenTableExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type ParsedQuery ¶
type ParsedQuery struct { Query string // contains filtered or unexported fields }
ParsedQuery represents a parsed query where bind locations are precompued for fast substitutions.
func GenerateParsedQuery ¶
func GenerateParsedQuery(node SQLNode) *ParsedQuery
GenerateParsedQuery returns a ParsedQuery of the ast.
func (*ParsedQuery) GenerateQuery ¶
func (pq *ParsedQuery) GenerateQuery(bindVariables map[string]interface{}) ([]byte, error)
GenerateQuery generates a query by substituting the specified bindVariables.
func (*ParsedQuery) MarshalJSON ¶
func (pq *ParsedQuery) MarshalJSON() ([]byte, error)
MarshalJSON is a custom JSON marshaler for ParsedQuery.
type RangeCond ¶
RangeCond represents a BETWEEN or a NOT BETWEEN expression.
func (*RangeCond) Format ¶
func (node *RangeCond) Format(buf *TrackedBuffer)
Format formats the node.
func (*RangeCond) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type RowTuple ¶
type RowTuple interface { ValExpr // contains filtered or unexported methods }
RowTuple represents a row of values. It can be ValTuple, Subquery.
type SQLName ¶
type SQLName string
SQLName is an SQL identifier. It will be escaped with backquotes if it matches a keyword.
func (SQLName) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type SQLNode ¶
type SQLNode interface { Format(buf *TrackedBuffer) // WalkSubtree calls visit on all underlying nodes // of the subtree, but not the current one. Walking // must be interrupted if visit returns an error. WalkSubtree(visit Visit) error }
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) AddHaving ¶
AddHaving adds the boolean expression to the HAVING clause as an AND condition. If the expression is an OR clause, it parenthesizes it. Currently, the OR operator is the only one that's lower precedence than AND.
func (*Select) AddWhere ¶
AddWhere adds the boolean expression to the WHERE clause as an AND condition. If the expression is an OR clause, it parenthesizes it. Currently, the OR operator is the only one that's lower precedence than AND.
func (*Select) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
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 *TrackedBuffer)
Format formats the node.
func (SelectExprs) WalkSubtree ¶
func (node SelectExprs) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type SelectStatement ¶
type SelectStatement interface { SQLNode // contains filtered or unexported methods }
SelectStatement any SELECT statement.
type Set ¶
type Set struct { Comments Comments Exprs UpdateExprs }
Set represents a SET statement.
func (*Set) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type SimpleTableExpr ¶
type SimpleTableExpr interface { SQLNode // contains filtered or unexported methods }
SimpleTableExpr represents a simple table expression.
type StarExpr ¶
type StarExpr struct {
TableName SQLName
}
StarExpr defines a '*' or 'table.*' expression.
func (*StarExpr) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Statement ¶
type Statement interface { SQLNode // contains filtered or unexported methods }
Statement represents a statement.
type StrVal ¶
type StrVal []byte
StrVal represents a string value.
func (StrVal) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Subquery ¶
type Subquery struct {
Select SelectStatement
}
Subquery represents a subquery.
func (*Subquery) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type TableExpr ¶
type TableExpr interface { SQLNode // contains filtered or unexported methods }
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)
Format formats the node.
func (TableExprs) WalkSubtree ¶
func (node TableExprs) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type TableName ¶
type TableName struct {
Name, Qualifier SQLName
}
TableName represents a table name. Qualifier, if specified, represents a database. It's generally not supported because vitess has its own rules about which database to send a query to.
func (*TableName) Format ¶
func (node *TableName) Format(buf *TrackedBuffer)
Format formats the node.
func (*TableName) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
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 creates a new TrackedBuffer.
func (*TrackedBuffer) HasBindVars ¶
func (buf *TrackedBuffer) HasBindVars() bool
HasBindVars returns true if the parsed query uses bind vars.
func (*TrackedBuffer) Myprintf ¶
func (buf *TrackedBuffer) Myprintf(format string, values ...interface{})
Myprintf mimics fmt.Fprintf(buf, ...), 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.
The name must be something other than the usual Printf() to avoid "go vet" warnings due to our custom format specifiers.
func (*TrackedBuffer) ParsedQuery ¶
func (buf *TrackedBuffer) ParsedQuery() *ParsedQuery
ParsedQuery returns a ParsedQuery that contains bind locations for easy substitution.
func (*TrackedBuffer) WriteArg ¶
func (buf *TrackedBuffer) WriteArg(arg string)
WriteArg writes a value argument into the buffer along with tracking information for future substitutions. arg must contain the ":" or "::" prefix.
type TupleEqualityList ¶
TupleEqualityList is for generating equality constraints for tables that have composite primary keys.
type UnaryExpr ¶
UnaryExpr represents a unary value expression.
func (*UnaryExpr) Format ¶
func (node *UnaryExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*UnaryExpr) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Union ¶
type Union struct { Type string Left, Right SelectStatement }
Union represents a UNION statement.
func (*Union) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Update ¶
type Update struct { Comments Comments Table *TableName Exprs UpdateExprs Where *Where OrderBy OrderBy Limit *Limit }
Update represents an UPDATE statement.
func (*Update) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type UpdateExpr ¶
UpdateExpr represents an update expression.
func (*UpdateExpr) Format ¶
func (node *UpdateExpr) Format(buf *TrackedBuffer)
Format formats the node.
func (*UpdateExpr) WalkSubtree ¶
func (node *UpdateExpr) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type UpdateExprs ¶
type UpdateExprs []*UpdateExpr
UpdateExprs represents a list of update expressions.
func (UpdateExprs) Format ¶
func (node UpdateExprs) Format(buf *TrackedBuffer)
Format formats the node.
func (UpdateExprs) WalkSubtree ¶
func (node UpdateExprs) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type ValArg ¶
type ValArg []byte
ValArg represents a named bind var argument.
func (ValArg) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type ValExpr ¶
type ValExpr interface { Expr // contains filtered or unexported methods }
ValExpr represents a value expression.
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) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type ValTuple ¶
type ValTuple ValExprs
ValTuple represents a tuple of actual values.
func (ValTuple) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Values ¶
type Values []RowTuple
Values represents a VALUES clause.
func (Values) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree
type Visit ¶
Visit defines the signature of a function that can be used to visit all nodes of a parse tree.
type When ¶
When represents a WHEN sub-expression.
func (*When) WalkSubtree ¶
WalkSubtree walks the nodes of the subtree