package
3.0.0-rc.3+incompatible
Repository: https://github.com/vitessio/vitess.git
Documentation: pkg.go.dev
# Functions
Append appends the SQLNode to the buffer.
BuildParsedQuery builds a ParsedQuery from the input.
EncodeValue encodes one bind variable value into the query.
ExprFromValue converts the given Value into an Expr or returns an error.
ExtractCommentDirectives parses the comment list for any execution directives of the form:
/*vt+ OPTION_ONE=1 OPTION_TWO OPTION_THREE=abcd */
It returns the map of the directive values or nil if there aren't any.
ExtractMysqlComment extracts the version and SQL from a comment-only query such as /*!50708 sql here */.
ExtractSetValues returns a map of key-value pairs if the query is a SET statement.
FetchBindVar resolves the bind variable by fetching it from bindVariables.
FormatImpossibleQuery creates an impossible query in a TrackedBuffer.
GetBindvars returns a map of the bind vars referenced in the statement.
GetTableName returns the table name from the SimpleTableExpr only if it's a simple expression.
IsColName returns true if the Expr is a *ColName.
IsDML returns true if the query is an INSERT, UPDATE or DELETE statement.
IsNull returns true if the Expr is SQL NULL.
IsSimpleTuple returns true if the Expr is a ValTuple that contains simple values or if it's a list arg.
IsValue returns true if the Expr is a string, integral or value arg.
KeywordString returns the string corresponding to the given keyword.
NewBitVal builds a new BitVal containing a bit literal.
NewColIdent makes a new ColIdent.
NewFloatVal builds a new FloatVal.
NewHexNum builds a new HexNum.
NewHexVal builds a new HexVal.
NewIntVal builds a new IntVal.
NewParsedQuery returns a ParsedQuery of the ast.
NewPlanValue builds a sqltypes.PlanValue from an Expr.
NewStringTokenizer creates a new Tokenizer for the sql string.
NewStrVal builds a new StrVal.
NewTableIdent creates a new TableIdent.
NewTokenizer creates a new Tokenizer reading a sql string from the io.Reader.
NewTrackedBuffer creates a new TrackedBuffer.
NewValArg builds a new ValArg.
NewWhere creates a WHERE or HAVING clause out of a Expr.
Normalize changes the statement to use bind values, and updates the bind vars to those values.
Parse parses the SQL in full and returns a Statement, which is the AST representation of the query.
ParseNext parses a single SQL statement from the tokenizer returning a Statement which is the AST representation of the query.
ParseNextStrictDDL is the same as ParseNext except it errors on partially parsed DDL statements.
ParseStrictDDL is the same as Parse except it errors on partially parsed DDL statements.
ParseTokenizer is a raw interface to parse from the given tokenizer.
Preview analyzes the beginning of the query using a simpler and faster textual comparison to identify the statement type.
RedactSQLQuery returns a sql string with the params stripped out for display.
ReplaceExpr finds the from expression from root and replaces it with to.
SkipQueryPlanCacheDirective returns true if skip query plan cache directive is set to true in query.
SplitMarginComments pulls out any leading or trailing comments from a raw sql query.
SplitStatement returns the first sql statement up to either a ; or EOF and the remainder from the given buffer.
SplitStatementToPieces split raw sql statement that may have multi sql pieces to sql pieces returns the sql pieces blob contains; or error if sql cannot be parsed.
StmtType returns the statement type as a string.
String returns a string representation of an SQLNode.
StripComments removes all comments from the string regardless of where they occur.
StripLeadingComments trims the SQL string and removes any leading comments.
TruncateForLog is used when displaying queries as part of error logs to avoid overwhelming logging systems with potentially long queries and bind value data.
TruncateForUI is used when displaying queries on various Vitess status pages to keep the pages small enough to load and render properly.
Walk calls visit on every node.
# Constants
DDL strings.
DDL strings.
DDL strings.
Order.Direction.
UnaryExpr.Operator.
RangeCond.Operator.
UnaryExpr.Operator.
BinaryExpr.Operator.
BinaryExpr.Operator.
These are the possible Valtype values.
BinaryExpr.Operator.
MatchExpr.Option.
These map to the SQL-defined reference actions.
this string is "character set" and this comment is required.
this string is "character set" and this comment is required.
DDL strings.
DDL strings.
DefaultAction indicates no action was explicitly specified.
Order.Direction.
DirectiveMultiShardAutocommit is the query comment directive to allow single round trip autocommit with a multi-shard statement.
DirectiveQueryTimeout sets a query timeout in vtgate.
DirectiveScatterErrorsAsWarnings enables partial success scatter select queries.
DirectiveSkipQueryPlanCache skips query plan cache when set.
Select.Distinct.
BinaryExpr.Operator.
DDL strings.
DDL strings.
DDL strings.
DDL strings.
ComparisonExpr.Operator.
These are the possible Valtype values.
DDL strings.
Index hints.
Select.Lock.
Set.Scope or Show.Scope.
ComparisonExpr.Operator.
ComparisonExpr.Operator.
Where.Type.
These are the possible Valtype values.
These are the possible Valtype values.
Index hints.
Set.Scope or Show.Scope.
DDL strings.
ComparisonExpr.Operator.
BinaryExpr.Operator.
These are the possible Valtype values.
IsExpr.Operator.
IsExpr.Operator.
IsExpr.Operator.
IsExpr.Operator.
IsExpr.Operator.
SetExpr.Expr, for SET TRANSACTION ..
SetExpr.Expr, for SET TRANSACTION ..
SetExpr.Expr, for SET TRANSACTION ..
SetExpr.Expr, for SET TRANSACTION ..
IsExpr.Operator.
JoinTableExpr.Join.
ComparisonExpr.Operator.
ComparisonExpr.Operator.
JoinTableExpr.Join.
ComparisonExpr.Operator.
ComparisonExpr.Operator.
ComparisonExpr.Operator.
BinaryExpr.Operator.
BinaryExpr.Operator.
BinaryExpr.Operator.
JoinTableExpr.Join.
MatchExpr.Option.
MatchExpr.Option.
JoinTableExpr.Join.
JoinTableExpr.Join.
These map to the SQL-defined reference actions.
RangeCond.Operator.
ComparisonExpr.Operator.
ComparisonExpr.Operator.
ComparisonExpr.Operator.
ComparisonExpr.Operator.
ComparisonExpr.Operator.
BinaryExpr.Operator.
MatchExpr.Option.
ComparisonExpr.Operator.
DDL strings.
Partition strings.
DDL strings.
These map to the SQL-defined reference actions.
JoinTableExpr.Join.
Set.Scope or Show.Scope.
These map to the SQL-defined reference actions.
These map to the SQL-defined reference actions.
Select.Lock.
BinaryExpr.Operator.
BinaryExpr.Operator.
Select.Cache.
Select.Cache.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
Select.Distinct.
JoinTableExpr.Join.
These are the possible Valtype values.
UnaryExpr.Operator.
TransactionStr is the Name for a SET TRANSACTION statement.
DDL strings.
SetExpr.Expr, for SET TRANSACTION ..
SetExpr.Expr, for SET TRANSACTION ..
UnaryExpr.Operator.
UnaryExpr.Operator.
Union.Type.
Union.Type.
Union.Type.
UnaryExpr.Operator.
Index hints.
UnaryExpr.Operator.
These are the possible Valtype values.
Vindex DDL param to specify the owner of a vindex.
Where.Type.
# Variables
Aggregates is a map of all aggregate functions.
ErrEmpty is a sentinel error returned when parsing empty statements.
TruncateErrLen truncate queries in error logs to the given length.
TruncateUILen truncate queries in debug UIs to the given length.
# Structs
AliasedExpr defines an aliased SELECT expression.
AliasedTableExpr represents a table expression coupled with an optional alias or index hint.
AndExpr represents an AND expression.
Begin represents a Begin statement.
BinaryExpr represents a binary value expression.
CaseExpr represents a CASE expression.
ColIdent is a case insensitive SQL identifier.
CollateExpr represents dynamic collate operator.
ColName represents a column name.
ColumnDefinition describes a column in a CREATE TABLE statement.
ColumnType represents a sql type in a CREATE TABLE statement All optional fields are nil if not specified.
Commit represents a Commit statement.
ComparisonExpr represents a two-value comparison expression.
ConstraintDefinition describes a constraint in a CREATE TABLE statement.
ConvertExpr represents a call to CONVERT(expr, type) or it's equivalent CAST(expr AS type).
ConvertType represents the type in call to CONVERT(expr, type).
ConvertUsingExpr represents a call to CONVERT(expr USING charset).
DBDDL represents a CREATE, DROP database statement.
DDL represents a CREATE, ALTER, DROP, RENAME, TRUNCATE or ANALYZE statement.
Default represents a DEFAULT expression.
Delete represents a DELETE statement.
ExistsExpr represents an EXISTS expression.
ForeignKeyDefinition describes a foreign key in a CREATE TABLE statement.
FuncExpr represents a function call.
GroupConcatExpr represents a call to GROUP_CONCAT.
IndexColumn describes a column in an index definition with optional length.
IndexDefinition describes an index in a CREATE TABLE statement.
IndexHints represents a list of index hints.
IndexInfo describes the name and type of an index in a CREATE TABLE statement.
IndexOption is used for trailing options for indexes: COMMENT, KEY_BLOCK_SIZE, USING.
Insert represents an INSERT or REPLACE statement.
IntervalExpr represents a date-time INTERVAL expression.
IsExpr represents an IS ..
JoinCondition represents the join conditions (either a ON or USING clause) of a JoinTableExpr.
JoinTableExpr represents a TableExpr that's a JOIN operation.
LengthScaleOption is used for types that have an optional length and scale.
Limit represents a LIMIT clause.
MarginComments holds the leading and trailing comments that surround a query.
MatchExpr represents a call to the MATCH function.
Nextval defines the NEXT VALUE expression.
NotExpr represents a NOT expression.
NullVal represents a NULL value.
OptLike works for create table xxx like xxx.
Order represents an ordering expression.
OrExpr represents an OR expression.
OtherAdmin represents a misc statement that relies on ADMIN privileges, such as REPAIR, OPTIMIZE, or TRUNCATE statement.
OtherRead represents a DESCRIBE, or EXPLAIN statement.
ParenExpr represents a parenthesized boolean expression.
ParenSelect is a parenthesized SELECT statement.
ParenTableExpr represents a parenthesized list of TableExpr.
ParsedQuery represents a parsed query where bind locations are precompued for fast substitutions.
PartitionDefinition describes a very minimal partition definition.
PartitionSpec describe partition actions (for alter and create).
RangeCond represents a BETWEEN or a NOT BETWEEN expression.
Rollback represents a Rollback statement.
Select represents a SELECT statement.
Set represents a SET statement.
SetExpr represents a set expression.
SetKey is the extracted key from one SetExpr.
Show represents a show statement.
ShowFilter is show tables filter.
ShowTablesOpt is show tables option.
SQLVal represents a single value.
StarExpr defines a '*' or 'table.*' expression.
Stream represents a SELECT statement.
Subquery represents a subquery.
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).
TableIdent is a case sensitive SQL identifier.
TableName represents a table name.
TableSpec describes the structure of a table from a CREATE TABLE statement.
Tokenizer is the struct used to generate SQL tokens for the parser.
TrackedBuffer is used to rebuild a query from the ast.
TupleEqualityList is for generating equality constraints for tables that have composite primary keys.
UnaryExpr represents a unary value expression.
Union represents a UNION statement.
Update represents an UPDATE statement.
UpdateExpr represents an update expression.
Use represents a use statement.
ValuesFuncExpr represents a function call.
VindexParam defines a key/value parameter for a CREATE VINDEX statement.
VindexSpec defines a vindex for a CREATE VINDEX or DROP VINDEX statement.
When represents a WHEN sub-expression.
Where represents a WHERE or HAVING clause.
# Interfaces
ColTuple represents a list of column values.
ConstraintInfo details a constraint in a CREATE TABLE statement.
Encodable defines the interface for types that can be custom-encoded into SQL.
Expr represents an expression.
InsertRows represents the rows for an INSERT statement.
SelectExpr represents a SELECT expression.
SelectStatement any SELECT statement.
SimpleTableExpr represents a simple table expression.
SQLNode defines the interface for all nodes generated by the parser.
Statement represents a statement.
TableExpr represents a table expression.
# Type aliases
BoolVal is true or false.
ColumnKeyOption indicates whether or not the given column is defined as an index element and contains the type of the option.
Columns represents an insert column list.
CommentDirectives is the parsed representation for execution directives conveyed in query comments.
Comments represents a list of comments.
Exprs represents a list of value expressions.
GroupBy represents a GROUP BY clause.
InsertValues is a custom SQL encoder for the values of an insert statement.
ListArg represents a named list argument.
NodeFormatter defines the signature of a custom node formatter function that can be given to TrackedBuffer for code generation.
OnDup represents an ON DUPLICATE KEY clause.
OrderBy represents an ORDER By clause.
Partitions is a type alias for Columns so we can handle printing efficiently.
ReferenceAction indicates the action takes by a referential constraint e.g.
SelectExprs represents SELECT expressions.
SetExprs represents a list of set expressions.
TableExprs represents a list of table expressions.
TableNames is a list of TableName.
UpdateExprs represents a list of update expressions.
ValTuple represents a tuple of actual values.
ValType specifies the type for SQLVal.
Values represents a VALUES clause.
Visit defines the signature of a function that can be used to visit all nodes of a parse tree.