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 GetTableName(node SimpleTableExpr) string
- func IsColName(node ValExpr) bool
- func IsNull(node ValExpr) bool
- func IsSimpleTuple(node ValExpr) bool
- func IsValue(node ValExpr) bool
- func SplitTrailingComments(sql string) (query, comments string)
- 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 ColIdent
- func (node ColIdent) Equal(in ColIdent) bool
- func (node ColIdent) EqualString(str string) bool
- func (node ColIdent) Format(buf *TrackedBuffer)
- func (node ColIdent) Lowered() string
- func (node ColIdent) Original() string
- func (node ColIdent) String() string
- func (node ColIdent) WalkSubtree(visit Visit) error
- 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 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 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 TableIdent
- 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 ( DistinctStr = "distinct " StraightJoinHint = "straight_join " )
Select.Distinct
const ( ForUpdateStr = " for update" )
Select.Lock
const ( UnionStr = "union" UnionAllStr = "union all" UnionDistinctStr = "union distinct" )
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 = 57360
const ALTER = 57418
const ANALYZE = 57421
const AND = 57397
const AS = 57362
const ASC = 57364
const BETWEEN = 57399
const BY = 57357
const CASE = 57400
const COMMENT = 57392
const CREATE = 57417
const CROSS = 57382
const DEFAULT = 57369
const DELETE = 57351
const DESC = 57365
const DESCRIBE = 57431
const DISTINCT = 57361
const DROP = 57419
const DUPLICATE = 57367
const ELSE = 57403
const END = 57416
const EXISTS = 57363
const EXPLAIN = 57432
const FALSE = 57395
const FOR = 57359
const FORCE = 57385
const FROM = 57352
const GE = 57405
const GROUP = 57354
const HAVING = 57355
const ID = 57387
const IF = 57427
const IGNORE = 57426
const IN = 57411
const INDEX = 57423
const INNER = 57380
const INSERT = 57349
const INTERVAL = 57415
const INTO = 57366
const IS = 57408
const JOIN = 57376
const KEY = 57368
const LAST_INSERT_ID = 57373
const LE = 57404
const LEFT = 57378
const LEX_ERROR = 57346
const LIKE = 57409
const LIMIT = 57358
const LIST_ARG = 57391
const LOCK = 57371
const NATURAL = 57383
const NE = 57406
const NEXT = 57374
const NOT = 57398
const NULL = 57393
const NULL_SAFE_EQUAL = 57407
const NUMBER = 57389
const ON = 57386
const OR = 57396
const ORDER = 57356
const OUTER = 57381
const REGEXP = 57410
const RENAME = 57420
const RIGHT = 57379
const SELECT = 57348
const SET = 57370
const SHIFT_LEFT = 57412
const SHIFT_RIGHT = 57413
const SHOW = 57430
const STRAIGHT_JOIN = 57377
const STRING = 57388
const TABLE = 57422
const THEN = 57402
const TO = 57425
const TRUE = 57394
const UNARY = 57414
const UNION = 57347
const UNIQUE = 57428
const UNUSED = 57433
const UPDATE = 57350
const USE = 57384
const USING = 57429
const VALUE = 57375
const VALUES = 57372
const VALUE_ARG = 57390
const VIEW = 57424
const WHEN = 57401
const WHERE = 57353
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 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 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.
func SplitTrailingComments ¶
SplitTrailingComments splits the query trailing comments from the query.
Types ¶
type AliasedTableExpr ¶
type AliasedTableExpr struct { Expr SimpleTableExpr As TableIdent 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 ColIdent ¶
ColIdent is a case insensitive SQL identifier. It will be escaped with backquotes if it matches a keyword.
func (ColIdent) EqualString ¶
EqualString performs a case-insensitive compare with str.
func (ColIdent) Lowered ¶
Lowered returns a lower-cased column name. This function should generally be used only for optimizing comparisons.
func (ColIdent) 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 ColIdent Qualifier *TableName }
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 []ColIdent
Columns represents an insert column list.
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 ¶
type DDL struct { Action string Table TableIdent NewName TableIdent }
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 Limit ¶
type Limit struct {
Offset, Rowcount ValExpr
}
Limit represents a LIMIT clause.
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 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 Hints 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 TableIdent
}
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 TableIdent ¶
type TableIdent string
TableIdent is a case sensitive SQL identifier. It will be escaped with backquotes if it matches a keyword.
func (TableIdent) Format ¶
func (node TableIdent) Format(buf *TrackedBuffer)
Format formats the node.
func (TableIdent) WalkSubtree ¶
func (node TableIdent) WalkSubtree(visit Visit) error
WalkSubtree walks the nodes of the subtree
type TableName ¶
type TableName struct {
Name, Qualifier TableIdent
}
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