Documentation
¶
Index ¶
- func Walk(v Visitor, node Node)
- type Assignment
- type BetweenExpr
- type BinaryExpr
- type BooleanLiteral
- type CaseExpr
- type CommonTableExpression
- type CreateViewStatement
- type DeleteStatement
- type DescribeStatement
- type DescribeTarget
- type DropViewStatement
- type ExistsExpr
- type Expr
- type FuncCall
- type Identifier
- type InExpr
- type InsertStatement
- type IsNullExpr
- type JoinCondition
- type JoinExpr
- type JoinType
- type LikeExpr
- type LimitClause
- type Node
- type NullLiteral
- type NumericLiteral
- type OrderDirection
- type OrderItem
- type Placeholder
- type SelectItem
- type SelectStatement
- type SetOperation
- type SetOperator
- type ShowTablesStatement
- type ShowViewsStatement
- type StarExpr
- type Statement
- type StringLiteral
- type SubqueryExpr
- type SubqueryTable
- type TableExpr
- type TableName
- type UnaryExpr
- type UpdateStatement
- type Visitor
- type WhenClause
- type WindowSpecification
- type WithClause
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Assignment ¶
type Assignment struct {
Column *Identifier
Value Expr
}
Assignment represents column=expr pairs in UPDATE SET.
type BetweenExpr ¶
BetweenExpr models BETWEEN operations.
func (*BetweenExpr) Accept ¶
func (b *BetweenExpr) Accept(v Visitor)
type BinaryExpr ¶
BinaryExpr models binary operations like a+b or a AND b.
func (*BinaryExpr) Accept ¶
func (b *BinaryExpr) Accept(v Visitor)
type BooleanLiteral ¶
type BooleanLiteral struct{ Value bool }
Literal kinds.
func (*BooleanLiteral) Accept ¶
func (b *BooleanLiteral) Accept(v Visitor)
type CaseExpr ¶
type CaseExpr struct {
Operand Expr
When []WhenClause
Else Expr
}
CaseExpr represents simple CASE constructs.
type CommonTableExpression ¶
type CommonTableExpression struct {
Name *Identifier
Columns []*Identifier
Select *SelectStatement
}
CommonTableExpression represents a single named subquery.
type CreateViewStatement ¶
type CreateViewStatement struct {
OrReplace bool
IfNotExists bool
Materialized bool
Name *Identifier
Columns []*Identifier
Select *SelectStatement
}
CreateViewStatement models CREATE VIEW statements.
func (*CreateViewStatement) Accept ¶
func (s *CreateViewStatement) Accept(v Visitor)
type DeleteStatement ¶
DeleteStatement models DELETE queries.
func (*DeleteStatement) Accept ¶
func (s *DeleteStatement) Accept(v Visitor)
type DescribeStatement ¶
type DescribeStatement struct {
Target DescribeTarget
Name *Identifier
}
DescribeStatement models DESCRIBE TABLE/VIEW statements.
func (*DescribeStatement) Accept ¶
func (s *DescribeStatement) Accept(v Visitor)
type DescribeTarget ¶
type DescribeTarget string
DescribeTarget enumerates the possible entities a DESCRIBE statement can address.
const ( DescribeTable DescribeTarget = "TABLE" DescribeView DescribeTarget = "VIEW" )
type DropViewStatement ¶
type DropViewStatement struct {
Materialized bool
IfExists bool
Name *Identifier
}
DropViewStatement models DROP VIEW statements.
func (*DropViewStatement) Accept ¶
func (s *DropViewStatement) Accept(v Visitor)
type ExistsExpr ¶
type ExistsExpr struct {
Not bool
Subquery *SelectStatement
}
ExistsExpr models EXISTS (subquery).
func (*ExistsExpr) Accept ¶
func (e *ExistsExpr) Accept(v Visitor)
type Expr ¶
type Expr interface {
Node
// contains filtered or unexported methods
}
Expr models SQL expressions.
type FuncCall ¶
type FuncCall struct {
Name Identifier
Distinct bool
Args []Expr
Over *WindowSpecification
}
FuncCall models function invocations.
type Identifier ¶
type Identifier struct {
Parts []string
}
Identifier models possibly qualified identifiers.
func (*Identifier) Accept ¶
func (i *Identifier) Accept(v Visitor)
type InExpr ¶
type InExpr struct {
Expr Expr
Not bool
Subquery *SelectStatement
List []Expr
}
InExpr models IN and NOT IN.
type InsertStatement ¶
type InsertStatement struct {
Table *TableName
Columns []*Identifier
Rows [][]Expr
Select *SelectStatement
}
InsertStatement models INSERT queries.
func (*InsertStatement) Accept ¶
func (s *InsertStatement) Accept(v Visitor)
type IsNullExpr ¶
IsNullExpr models IS [NOT] NULL.
func (*IsNullExpr) Accept ¶
func (i *IsNullExpr) Accept(v Visitor)
type JoinExpr ¶
type JoinExpr struct {
Left TableExpr
Right TableExpr
Type JoinType
Condition JoinCondition
}
JoinExpr represents a JOIN expression.
type LimitClause ¶
LimitClause captures LIMIT/OFFSET values.
type Node ¶
type Node interface {
Accept(Visitor)
}
Node represents any AST element that can accept a Visitor.
type NullLiteral ¶
type NullLiteral struct{}
Literal kinds.
func (*NullLiteral) Accept ¶
func (n *NullLiteral) Accept(v Visitor)
type NumericLiteral ¶
type NumericLiteral struct{ Value string }
Literal kinds.
func (*NumericLiteral) Accept ¶
func (n *NumericLiteral) Accept(v Visitor)
type OrderDirection ¶
type OrderDirection string
OrderDirection enumerates ORDER BY directions.
const ( Ascending OrderDirection = "ASC" Descending OrderDirection = "DESC" )
type OrderItem ¶
type OrderItem struct {
Expr Expr
Direction OrderDirection
}
OrderItem represents ORDER BY terms.
type Placeholder ¶
type Placeholder struct{ Symbol string }
Literal kinds.
func (*Placeholder) Accept ¶
func (p *Placeholder) Accept(v Visitor)
type SelectItem ¶
SelectItem describes an item in the SELECT list.
type SelectStatement ¶
type SelectStatement struct {
With *WithClause
Distinct bool
Columns []SelectItem
From TableExpr
Where Expr
GroupBy []Expr
Having Expr
OrderBy []OrderItem
Limit *LimitClause
SetOps []SetOperation
}
SelectStatement captures a SELECT query.
func (*SelectStatement) Accept ¶
func (s *SelectStatement) Accept(v Visitor)
Accept satisfies Node for SelectStatement.
type SetOperation ¶
type SetOperation struct {
Operator SetOperator
All bool
Select *SelectStatement
}
SetOperation joins the current SELECT with another via UNION/INTERSECT/EXCEPT.
type SetOperator ¶
type SetOperator string
SetOperator describes set combination types.
const ( SetOpUnion SetOperator = "UNION" SetOpIntersect SetOperator = "INTERSECT" SetOpExcept SetOperator = "EXCEPT" )
type ShowTablesStatement ¶
type ShowTablesStatement struct{}
ShowTablesStatement models SHOW TABLES commands.
func (*ShowTablesStatement) Accept ¶
func (s *ShowTablesStatement) Accept(v Visitor)
type ShowViewsStatement ¶
type ShowViewsStatement struct{}
ShowViewsStatement models SHOW VIEWS commands.
func (*ShowViewsStatement) Accept ¶
func (s *ShowViewsStatement) Accept(v Visitor)
type Statement ¶
type Statement interface {
Node
// contains filtered or unexported methods
}
Statement is the root type for SQL statements.
type StringLiteral ¶
type StringLiteral struct{ Value string }
Literal kinds.
func (*StringLiteral) Accept ¶
func (s *StringLiteral) Accept(v Visitor)
type SubqueryExpr ¶
type SubqueryExpr struct {
Select *SelectStatement
}
SubqueryExpr allows scalar subqueries.
func (*SubqueryExpr) Accept ¶
func (s *SubqueryExpr) Accept(v Visitor)
type SubqueryTable ¶
type SubqueryTable struct {
Select *SelectStatement
Alias string
}
SubqueryTable wraps a subquery used as table expression.
func (*SubqueryTable) Accept ¶
func (t *SubqueryTable) Accept(v Visitor)
type TableExpr ¶
type TableExpr interface {
Node
// contains filtered or unexported methods
}
TableExpr represents selectable table expressions.
type TableName ¶
type TableName struct {
Name *Identifier
Alias string
}
TableName represents a table reference with optional alias.
type UpdateStatement ¶
type UpdateStatement struct {
Table TableExpr
Assignments []Assignment
From TableExpr
Where Expr
}
UpdateStatement models UPDATE queries.
func (*UpdateStatement) Accept ¶
func (s *UpdateStatement) Accept(v Visitor)
type WhenClause ¶
WhenClause holds CASE branches.
type WindowSpecification ¶
WindowSpecification describes OVER(...) clauses on function calls.
type WithClause ¶
type WithClause struct {
Recursive bool
CTEs []CommonTableExpression
}
WithClause stores common table expressions.