package
0.0.14-alpha04
Repository: https://github.com/stackql/stackql-parser.git
Documentation: pkg.go.dev
# Packages
Package visitorgen is responsible for taking the ast.go of Vitess andand producing visitor infrastructure for it.
# Functions
Append appends the SQLNode to the buffer.
ASTToStatementType returns a StatementType from an AST stmt.
BuildParsedQuery builds a ParsedQuery from the input.
CanNormalize takes Statement and returns if the statement can be normalized.
String returns a string representation of an SQLNode.
No description provided by the author
Convert converts between AST expressions and executable expressions.
EncodeValue encodes one bind variable value into the query.
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 */.
FetchBindVar resolves the bind variable by fetching it from bindVariables.
No description provided by the author
FormatImpossibleQuery creates an impossible query in a TrackedBuffer.
No description provided by the author
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.
IgnoreMaxPayloadSizeDirective returns true if the max payload size override directive is set to true.
IsColName returns true if the Expr is a *ColName.
IsDML returns true if the query is an INSERT, UPDATE or DELETE statement.
IsDMLStatement returns true if the query is an INSERT, UPDATE or DELETE statement.
IsNull returns true if the Expr is SQL NULL.
IsSetStatement takes Statement and returns if the statement is set statement.
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.
IsVschemaDDL returns true if the query is an Vschema alter ddl.
KeywordString returns the string corresponding to the given keyword.
LikeToRegexp converts a like sql expression to regular expression.
NewBitVal builds a new BitVal containing a bit literal.
NewColIdent makes a new ColIdent.
NewColIdentWithAt makes a new ColIdent.
NewExec makes a new Exec.
NewExecVarDef makes a new ExecVarDef.
NewFloatVal builds a new FloatVal.
NewHexNum builds a new HexNum.
NewHexVal builds a new HexVal.
NewIntVal builds a new IntVal.
NewNativeQuery makes a new NativeQuery.
NewParsedQuery returns a ParsedQuery of the ast.
NewPlanValue builds a sqltypes.PlanValue from an Expr.
NewPurge makes a new Purge.
NewSelect is used to create a select statement.
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.
PrepareAST will normalize the query.
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.
Rewrite traverses a syntax tree recursively, starting with root, and calling pre and post for each node as described below.
RewriteAST rewrites the whole AST, replacing function calls and adding column aliases to queries.
SkipQueryPlanCacheDirective returns true if skip query plan cache directive is set to true in query.
SplitAndExpression breaks up the Expr into AND-separated conditions and appends them to filters.
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.
String returns a string representation of an SQLNode.
StripLeadingComments trims the SQL string and removes any leading comments.
TableFromStatement returns the qualified table name for the query.
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.
Unionize returns a UNION, either creating one or adding SELECT to an existing one.
Walk calls visit on every node.
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Order.Direction.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RangeCond.Operator.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
BinaryExpr.Operator.
No description provided by the author
These are the possible Valtype values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MatchExpr.Option.
No description provided by the author
No description provided by the author
These map to the SQL-defined reference actions.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
this string is "character set" and this comment is required.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DDL strings.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DBVarName is a reserved bind var name for database().
No description provided by the author
No description provided by the author
DefaultAction indicates no action was explicitly specified.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DirectiveIgnoreMaxPayloadSize skips payload size validation when set.
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.
No description provided by the author
No description provided by the author
Select.Distinct.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DoubleAt represnts @@.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ComparisonExpr.Operator.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
These are the possible Valtype values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Select.Lock.
FoundRowsName is a reserved bind var name for found_rows().
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
These are the possible Valtype values.
No description provided by the author
These are the possible Valtype values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DDL strings.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Auth constants.
No description provided by the author
No description provided by the author
No description provided by the author
These are the possible Valtype values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IsExpr.Operator.
No description provided by the author
No description provided by the author
No description provided by the author
JoinTableExpr.Join.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Cardinality increase functions.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
LastInsertIDName is a reserved bind var name for last_insert_id().
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
View Modifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
These map to the SQL-defined reference actions.
NoAt represents no @.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Transaction isolation levels.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Partition strings.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
These map to the SQL-defined reference actions.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RowCountName is a reserved bind var name for row_count().
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Set.Scope or Show.Scope.
No description provided by the author
These map to the SQL-defined reference actions.
These map to the SQL-defined reference actions.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SingleAt represents @.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Select.Cache.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
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.
These constants are used to identify the SQL statement type.
These constants are used to identify the SQL statement type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
These are the possible Valtype values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Table Modifiers.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SetExpr.Expr, for SET TRANSACTION ..
No description provided by the author
Explain formats.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Union.Type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
UnaryExpr.Operator.
No description provided by the author
UserDefinedVariableName is what we prepend bind var names for user defined variables.
Index hints.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
These are the possible Valtype values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Vindex DDL param to specify the owner of a vindex.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Where.Type.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
Aggregates is a map of all aggregate functions.
ErrEmpty is a sentinel error returned when parsing empty statements.
No description provided by the author
KeywordStrings contains the reverse mapping of token to keyword strings.
TruncateErrLen truncate queries in error logs to the given length.
TruncateUILen truncate queries in debug UIs to the given length.
# Structs
Statements.
No description provided by the author
No description provided by the author
*********** Expressions.
Statements.
Statements.
AutoIncSpec defines and autoincrement value for a ADD AUTO_INCREMENT statement.
Statements.
*********** Expressions.
BindVarNeeds represents the bind vars that need to be provided as the result of expression rewriting.
*********** Expressions.
ColIdent is a case insensitive SQL identifier.
*********** Expressions.
*********** Expressions.
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.
Statements.
*********** Expressions.
ConstraintDefinition describes a constraint in a CREATE TABLE statement.
*********** Expressions.
ConvertType represents the type in call to CONVERT(expr, type).
*********** Expressions.
A Cursor describes a node encountered during Apply.
*********** Expressions.
Statements.
Statements.
*********** Expressions.
Statements.
Statements.
Statements.
No description provided by the author
No description provided by the author
*********** Expressions.
Statements.
No description provided by the author
*********** Expressions.
*********** Expressions.
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.
Statements.
*********** Expressions.
*********** Expressions.
Statements.
JoinCondition represents the join conditions (either a ON or USING clause) of a JoinTableExpr.
No description provided by the author
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.
*********** Expressions.
Statements.
No description provided by the author
*********** Expressions.
*********** Expressions.
OptLike works for create table xxx like xxx.
Order represents an ordering expression.
*********** Expressions.
Statements.
Statements.
Statements.
No description provided by the author
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).
PositionedErr holds context related to parser errors.
Statements.
*********** Expressions.
Statements.
Statements.
Statements.
RewriteASTResult contains the rewritten ast and meta information about it.
Statements.
Statements.
Statements.
Statements.
SetExpr represents a set expression.
Statements.
Statements.
ShowFilter is show tables filter.
ShowTablesOpt is show tables option.
Statements.
*********** Expressions.
Statements.
No description provided by the author
Statements.
No description provided by the author
*********** Expressions.
TableIdent is a case sensitive SQL identifier.
No description provided by the author
TableSpec describes the structure of a table from a CREATE TABLE statement.
No description provided by the author
*********** Expressions.
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.
*********** Expressions.
*********** Expressions.
Statements.
Statements.
Statements.
UpdateExpr represents an update expression.
Statements.
*********** Expressions.
VindexParam defines a key/value parameter for a CREATE VINDEX statement.
VindexSpec defines a vindex for a CREATE VINDEX or DROP VINDEX statement.
*********** Expressions.
Where represents a WHERE or HAVING clause.
*********** Expressions.
# Interfaces
Statements.
*********** Expressions.
No description provided by the author
Encodable defines the interface for types that can be custom-encoded into SQL.
*********** Expressions.
InsertRows represents the rows for an INSERT statement.
No description provided by the author
Statements.
No description provided by the author
No description provided by the author
SQLNode defines the interface for all nodes generated by the parser.
Statements.
No description provided by the author
# Type aliases
An ApplyFunc is invoked by Rewrite for each node n, even if n is nil, before and/or after the node's children, using a Cursor describing the current node and providing operations on it.
AtCount represents the '@' count in ColIdent.
*********** Expressions.
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.
*********** Expressions.
*********** Expressions.
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.
Precendence is used to know the precedence between operators, so we can introduce parens when needed in the String representation of the AST.
ReferenceAction indicates the action takes by a referential constraint e.g.
SelectExprs represents SELECT expressions.
SetExprs represents a list of set expressions.
StatementType encodes the type of a SQL statement.
TableExprs represents a list of table expressions.
TableNames is a list of TableName.
UpdateExprs represents a list of update expressions.
*********** Expressions.
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.