Documentation ¶
Overview ¶
Package ast is the abstract syntax tree parsed from a SQL statement by parser. It can be analysed and transformed by optimizer.
Index ¶
- Constants
- type AggregateFuncExpr
- type BeginStmt
- type BinaryExpr
- type BindVariable
- type ByItem
- type CaseExpr
- type CastFuncExpr
- type CommitStmt
- type CreateGraphStmt
- type CreateIndexStmt
- type CreateLabelStmt
- type DDLNode
- type DMLNode
- type DataType
- type DeleteStmt
- type DropGraphStmt
- type DropIndexStmt
- type DropLabelStmt
- type EdgeDirection
- type EdgePattern
- type ExistsSubqueryExpr
- type ExpAsVar
- type ExplainStmt
- type ExprNode
- type ExtractField
- type ExtractFuncExpr
- type FuncCallExpr
- type GraphElementInsertion
- func (g *GraphElementInsertion) Accept(v Visitor) (node Node, ok bool)
- func (n *GraphElementInsertion) OriginTextPosition() int
- func (g *GraphElementInsertion) Restore(ctx *format.RestoreCtx) error
- func (n *GraphElementInsertion) SetOriginTextPosition(offset int)
- func (n *GraphElementInsertion) SetText(text string)
- func (n *GraphElementInsertion) Text() string
- type GraphElementUpdate
- type GroupByClause
- func (n *GroupByClause) Accept(v Visitor) (Node, bool)
- func (n *GroupByClause) OriginTextPosition() int
- func (n *GroupByClause) Restore(ctx *format.RestoreCtx) error
- func (n *GroupByClause) SetOriginTextPosition(offset int)
- func (n *GroupByClause) SetText(text string)
- func (n *GroupByClause) Text() string
- type HavingClause
- func (n *HavingClause) Accept(v Visitor) (Node, bool)
- func (n *HavingClause) OriginTextPosition() int
- func (n *HavingClause) Restore(ctx *format.RestoreCtx) error
- func (n *HavingClause) SetOriginTextPosition(offset int)
- func (n *HavingClause) SetText(text string)
- func (n *HavingClause) Text() string
- type IndexKeyType
- type InsertStmt
- type InsertionType
- type IsNullExpr
- type LabelsAndProperties
- func (l *LabelsAndProperties) Accept(v Visitor) (node Node, ok bool)
- func (n *LabelsAndProperties) OriginTextPosition() int
- func (l *LabelsAndProperties) Restore(ctx *format.RestoreCtx) error
- func (n *LabelsAndProperties) SetOriginTextPosition(offset int)
- func (n *LabelsAndProperties) SetText(text string)
- func (n *LabelsAndProperties) Text() string
- type LimitClause
- type MatchClause
- type MatchClauseList
- func (n *MatchClauseList) Accept(v Visitor) (Node, bool)
- func (n *MatchClauseList) OriginTextPosition() int
- func (n *MatchClauseList) Restore(ctx *format.RestoreCtx) error
- func (n *MatchClauseList) SetOriginTextPosition(offset int)
- func (n *MatchClauseList) SetText(text string)
- func (n *MatchClauseList) Text() string
- type Node
- type OrderByClause
- func (n *OrderByClause) Accept(v Visitor) (Node, bool)
- func (n *OrderByClause) OriginTextPosition() int
- func (n *OrderByClause) Restore(ctx *format.RestoreCtx) error
- func (n *OrderByClause) SetOriginTextPosition(offset int)
- func (n *OrderByClause) SetText(text string)
- func (n *OrderByClause) Text() string
- type ParenthesesExpr
- type PathPattern
- type PathPatternMacro
- func (n *PathPatternMacro) Accept(v Visitor) (Node, bool)
- func (n *PathPatternMacro) OriginTextPosition() int
- func (n *PathPatternMacro) Restore(ctx *format.RestoreCtx) error
- func (n *PathPatternMacro) SetOriginTextPosition(offset int)
- func (n *PathPatternMacro) SetText(text string)
- func (n *PathPatternMacro) Text() string
- type PathPatternType
- type PatternInExpr
- type PatternQuantifier
- func (n *PatternQuantifier) Accept(v Visitor) (Node, bool)
- func (n *PatternQuantifier) OriginTextPosition() int
- func (n *PatternQuantifier) Restore(ctx *format.RestoreCtx) error
- func (n *PatternQuantifier) SetOriginTextPosition(offset int)
- func (n *PatternQuantifier) SetText(text string)
- func (n *PatternQuantifier) Text() string
- type PatternQuantifierType
- type PropertyAccess
- type PropertyAssignment
- func (p *PropertyAssignment) Accept(v Visitor) (node Node, ok bool)
- func (n *PropertyAssignment) OriginTextPosition() int
- func (p *PropertyAssignment) Restore(ctx *format.RestoreCtx) error
- func (n *PropertyAssignment) SetOriginTextPosition(offset int)
- func (n *PropertyAssignment) SetText(text string)
- func (n *PropertyAssignment) Text() string
- type QuantifiedPathExpr
- func (n *QuantifiedPathExpr) Accept(v Visitor) (Node, bool)
- func (n *QuantifiedPathExpr) OriginTextPosition() int
- func (n *QuantifiedPathExpr) Restore(ctx *format.RestoreCtx) error
- func (n *QuantifiedPathExpr) SetOriginTextPosition(offset int)
- func (n *QuantifiedPathExpr) SetText(text string)
- func (n *QuantifiedPathExpr) Text() string
- type ReachabilityPathExpr
- func (n *ReachabilityPathExpr) Accept(v Visitor) (Node, bool)
- func (n *ReachabilityPathExpr) OriginTextPosition() int
- func (n *ReachabilityPathExpr) Restore(ctx *format.RestoreCtx) error
- func (n *ReachabilityPathExpr) SetOriginTextPosition(offset int)
- func (n *ReachabilityPathExpr) SetText(text string)
- func (n *ReachabilityPathExpr) Text() string
- type RollbackStmt
- func (r *RollbackStmt) Accept(v Visitor) (node Node, ok bool)
- func (n *RollbackStmt) OriginTextPosition() int
- func (r *RollbackStmt) Restore(ctx *format.RestoreCtx) error
- func (n *RollbackStmt) SetOriginTextPosition(offset int)
- func (n *RollbackStmt) SetText(text string)
- func (n *RollbackStmt) Text() string
- type SelectClause
- func (n *SelectClause) Accept(v Visitor) (node Node, ok bool)
- func (n *SelectClause) OriginTextPosition() int
- func (n *SelectClause) Restore(ctx *format.RestoreCtx) error
- func (n *SelectClause) SetOriginTextPosition(offset int)
- func (n *SelectClause) SetText(text string)
- func (n *SelectClause) Text() string
- type SelectElement
- func (n *SelectElement) Accept(v Visitor) (node Node, ok bool)
- func (n *SelectElement) OriginTextPosition() int
- func (n *SelectElement) Restore(ctx *format.RestoreCtx) error
- func (n *SelectElement) SetOriginTextPosition(offset int)
- func (n *SelectElement) SetText(text string)
- func (n *SelectElement) Text() string
- type SelectStmt
- type ShowStmt
- type ShowTarget
- type StmtNode
- type SubqueryExpr
- type SubstrFuncExpr
- type UnaryExpr
- type UpdateStmt
- type UseStmt
- type ValueExpr
- type VariableReference
- type VariableSpec
- func (n *VariableSpec) Accept(v Visitor) (Node, bool)
- func (n *VariableSpec) OriginTextPosition() int
- func (n *VariableSpec) Restore(ctx *format.RestoreCtx) error
- func (n *VariableSpec) SetOriginTextPosition(offset int)
- func (n *VariableSpec) SetText(text string)
- func (n *VariableSpec) Text() string
- type VertexPairConnection
- type VertexPattern
- func (n *VertexPattern) Accept(v Visitor) (Node, bool)
- func (n *VertexPattern) OriginTextPosition() int
- func (n *VertexPattern) Restore(ctx *format.RestoreCtx) error
- func (n *VertexPattern) SetOriginTextPosition(offset int)
- func (n *VertexPattern) SetText(text string)
- func (n *VertexPattern) Text() string
- type Visitor
- type WhenClause
Constants ¶
const ( EdgeDirectionOutgoing = iota EdgeDirectionIncoming EdgeDirectionAnyDirected )
const ( PatternQuantifierZeroOrMore = iota PatternQuantifierOneOrMore PatternQuantifierOptional PatternQuantifierExactlyN PatternQuantifierNOrMore PatternQuantifierBetweenNAndM PatternQuantifierBetweenZeroAndM )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateFuncExpr ¶
type AggregateFuncExpr struct { // F is the function name. F string // Args is the function args. Args []ExprNode // Distinct is true, function hence only aggregate distinct values. // For example, column c1 values are "1", "2", "2", "sum(c1)" is "5", // but "sum(distinct c1)" is "3". Distinct bool // contains filtered or unexported fields }
AggregateFuncExpr represents aggregate function expression.
func (*AggregateFuncExpr) Accept ¶
func (n *AggregateFuncExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*AggregateFuncExpr) Restore ¶
func (n *AggregateFuncExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type BinaryExpr ¶
type BinaryExpr struct { // Op is the operator code for BinaryOperation. Op opcode.Op // L is the left expression in BinaryOperation. L ExprNode // R is the right expression in BinaryOperation. R ExprNode // contains filtered or unexported fields }
BinaryExpr is for binary operation like `1 + 1`, `1 - 1`, etc.
func (*BinaryExpr) Accept ¶
func (n *BinaryExpr) Accept(v Visitor) (Node, bool)
Accept implements Node interface.
func (*BinaryExpr) Restore ¶
func (n *BinaryExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type BindVariable ¶
type BindVariable struct {
// contains filtered or unexported fields
}
func (*BindVariable) Restore ¶
func (n *BindVariable) Restore(ctx *format.RestoreCtx) error
type ByItem ¶
type ByItem struct { Expr *ExpAsVar Desc bool NullOrder bool // contains filtered or unexported fields }
ByItem represents an item in order by or group by.
func (*ByItem) OriginTextPosition ¶
func (n *ByItem) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*ByItem) Restore ¶
func (n *ByItem) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*ByItem) SetOriginTextPosition ¶
func (n *ByItem) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type CaseExpr ¶
type CaseExpr struct { // Value is the compare value expression. Value ExprNode // WhenClauses is the condition check expression. WhenClauses []*WhenClause // ElseClause is the else result expression. ElseClause ExprNode // contains filtered or unexported fields }
CaseExpr is the case expression.
type CastFuncExpr ¶
type CastFuncExpr struct { // Expr is the expression to be converted. Expr ExprNode // DataType is the conversion type. DataType DataType // contains filtered or unexported fields }
func (*CastFuncExpr) Accept ¶
func (n *CastFuncExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*CastFuncExpr) Restore ¶
func (n *CastFuncExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type CommitStmt ¶
type CommitStmt struct {
// contains filtered or unexported fields
}
func (*CommitStmt) Restore ¶
func (c *CommitStmt) Restore(ctx *format.RestoreCtx) error
type CreateGraphStmt ¶
type CreateGraphStmt struct { IfNotExists bool Graph model.CIStr // contains filtered or unexported fields }
func (*CreateGraphStmt) Restore ¶
func (n *CreateGraphStmt) Restore(ctx *format.RestoreCtx) error
type CreateIndexStmt ¶
type CreateIndexStmt struct { KeyType IndexKeyType IfNotExists bool IndexName model.CIStr Properties []model.CIStr // contains filtered or unexported fields }
CreateIndexStmt is a statement to create an index. See https://dev.mysql.com/doc/refman/5.7/en/create-index.html
func (*CreateIndexStmt) Accept ¶
func (n *CreateIndexStmt) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*CreateIndexStmt) Restore ¶
func (n *CreateIndexStmt) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type CreateLabelStmt ¶
type CreateLabelStmt struct { IfNotExists bool Label model.CIStr // contains filtered or unexported fields }
func (*CreateLabelStmt) Accept ¶
func (n *CreateLabelStmt) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*CreateLabelStmt) Restore ¶
func (n *CreateLabelStmt) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type DDLNode ¶
type DDLNode interface { StmtNode // contains filtered or unexported methods }
DDLNode represents DDL statement node.
type DMLNode ¶
type DMLNode interface { StmtNode // contains filtered or unexported methods }
DMLNode represents DML statement node.
type DeleteStmt ¶
type DeleteStmt struct { PathPatternMacros []*PathPatternMacro VariableNames []model.CIStr From *MatchClauseList Where ExprNode GroupBy *GroupByClause Having *HavingClause OrderBy *OrderByClause Limit *LimitClause // contains filtered or unexported fields }
func (*DeleteStmt) Restore ¶
func (d *DeleteStmt) Restore(ctx *format.RestoreCtx) error
type DropGraphStmt ¶
type DropGraphStmt struct { IfExists bool Graph model.CIStr // contains filtered or unexported fields }
func (*DropGraphStmt) Restore ¶
func (n *DropGraphStmt) Restore(ctx *format.RestoreCtx) error
type DropIndexStmt ¶
type DropIndexStmt struct { IfExists bool IndexName model.CIStr // contains filtered or unexported fields }
DropIndexStmt is a statement to drop the index. See https://dev.mysql.com/doc/refman/5.7/en/drop-index.html
func (*DropIndexStmt) Accept ¶
func (n *DropIndexStmt) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*DropIndexStmt) Restore ¶
func (n *DropIndexStmt) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type DropLabelStmt ¶
type DropLabelStmt struct { IfExists bool Label model.CIStr // contains filtered or unexported fields }
func (*DropLabelStmt) Restore ¶
func (n *DropLabelStmt) Restore(ctx *format.RestoreCtx) error
type EdgeDirection ¶
type EdgeDirection int
type EdgePattern ¶
type EdgePattern struct { Variable *VariableSpec Direction EdgeDirection // contains filtered or unexported fields }
func (*EdgePattern) OriginTextPosition ¶
func (n *EdgePattern) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*EdgePattern) Restore ¶
func (n *EdgePattern) Restore(ctx *format.RestoreCtx) error
func (*EdgePattern) SetOriginTextPosition ¶
func (n *EdgePattern) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type ExistsSubqueryExpr ¶
type ExistsSubqueryExpr struct { // Sel is the subquery, may be rewritten to other type of expression. Sel ExprNode // Not is true, the expression is "not exists". Not bool // contains filtered or unexported fields }
ExistsSubqueryExpr is the expression for "exists (select ...)". See https://dev.mysql.com/doc/refman/5.7/en/exists-and-not-exists-subqueries.html
func (*ExistsSubqueryExpr) Accept ¶
func (n *ExistsSubqueryExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*ExistsSubqueryExpr) Restore ¶
func (n *ExistsSubqueryExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type ExpAsVar ¶
func (*ExpAsVar) OriginTextPosition ¶
func (n *ExpAsVar) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*ExpAsVar) SetOriginTextPosition ¶
func (n *ExpAsVar) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type ExplainStmt ¶
type ExplainStmt struct { Select *SelectStmt // contains filtered or unexported fields }
func (*ExplainStmt) Restore ¶
func (e *ExplainStmt) Restore(ctx *format.RestoreCtx) error
type ExprNode ¶
type ExprNode interface { Node // contains filtered or unexported methods }
ExprNode is a node that can be evaluated. Name of implementations should have 'Expr' suffix.
type ExtractField ¶
type ExtractField byte
const ( ExtractFieldYear ExtractField = iota ExtractFieldMonth ExtractFieldDay ExtractFieldHour ExtractFieldMinute ExtractFieldSecond ExtractFieldTimezoneHour ExtractFieldTimezoneMinute )
type ExtractFuncExpr ¶
type ExtractFuncExpr struct { ExtractField ExtractField Expr ExprNode // contains filtered or unexported fields }
ExtractFuncExpr is for function expression.
func (*ExtractFuncExpr) Restore ¶
func (e *ExtractFuncExpr) Restore(ctx *format.RestoreCtx) error
type FuncCallExpr ¶
type FuncCallExpr struct { // FnName is the function name. FnName model.CIStr // Args is the function args. Args []ExprNode // contains filtered or unexported fields }
FuncCallExpr is for function expression.
func (*FuncCallExpr) Accept ¶
func (n *FuncCallExpr) Accept(v Visitor) (Node, bool)
Accept implements Node interface.
func (*FuncCallExpr) Restore ¶
func (n *FuncCallExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type GraphElementInsertion ¶
type GraphElementInsertion struct { InsertionType InsertionType VariableName model.CIStr From model.CIStr To model.CIStr LabelsAndProperties *LabelsAndProperties // contains filtered or unexported fields }
func (*GraphElementInsertion) Accept ¶
func (g *GraphElementInsertion) Accept(v Visitor) (node Node, ok bool)
func (*GraphElementInsertion) OriginTextPosition ¶
func (n *GraphElementInsertion) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*GraphElementInsertion) Restore ¶
func (g *GraphElementInsertion) Restore(ctx *format.RestoreCtx) error
func (*GraphElementInsertion) SetOriginTextPosition ¶
func (n *GraphElementInsertion) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type GraphElementUpdate ¶
type GraphElementUpdate struct { VariableName model.CIStr Assignments []*PropertyAssignment // contains filtered or unexported fields }
func (*GraphElementUpdate) Accept ¶
func (g *GraphElementUpdate) Accept(v Visitor) (node Node, ok bool)
func (*GraphElementUpdate) Restore ¶
func (g *GraphElementUpdate) Restore(ctx *format.RestoreCtx) error
type GroupByClause ¶
type GroupByClause struct { Items []*ByItem // contains filtered or unexported fields }
func (*GroupByClause) Accept ¶
func (n *GroupByClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*GroupByClause) OriginTextPosition ¶
func (n *GroupByClause) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*GroupByClause) Restore ¶
func (n *GroupByClause) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*GroupByClause) SetOriginTextPosition ¶
func (n *GroupByClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type HavingClause ¶
type HavingClause struct { Expr ExprNode // contains filtered or unexported fields }
HavingClause represents having clause.
func (*HavingClause) Accept ¶
func (n *HavingClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*HavingClause) OriginTextPosition ¶
func (n *HavingClause) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*HavingClause) Restore ¶
func (n *HavingClause) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*HavingClause) SetOriginTextPosition ¶
func (n *HavingClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type IndexKeyType ¶
type IndexKeyType int
IndexKeyType is the type for index key.
const ( IndexKeyTypeNone IndexKeyType = iota IndexKeyTypeUnique )
Index key types.
type InsertStmt ¶
type InsertStmt struct { PathPatternMacros []*PathPatternMacro IntoGraphName model.CIStr Insertions []*GraphElementInsertion // Full modify query // ref: https://pgql-lang.org/spec/1.5/#insert From *MatchClauseList Where ExprNode GroupBy *GroupByClause Having *HavingClause OrderBy *OrderByClause Limit *LimitClause // contains filtered or unexported fields }
func (*InsertStmt) Restore ¶
func (n *InsertStmt) Restore(ctx *format.RestoreCtx) error
type InsertionType ¶
type InsertionType byte
const ( InsertionTypeVertex InsertionType = 1 InsertionTypeEdge InsertionType = 2 )
func (InsertionType) String ¶
func (it InsertionType) String() string
String implements the fmt.Stringer interface
type IsNullExpr ¶
type IsNullExpr struct { // Expr is the expression to be checked. Expr ExprNode // Not is true, the expression is "is not null". Not bool // contains filtered or unexported fields }
IsNullExpr is the expression for null check.
func (*IsNullExpr) Accept ¶
func (n *IsNullExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*IsNullExpr) Restore ¶
func (n *IsNullExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type LabelsAndProperties ¶
type LabelsAndProperties struct { Labels []model.CIStr Assignments []*PropertyAssignment // contains filtered or unexported fields }
func (*LabelsAndProperties) Accept ¶
func (l *LabelsAndProperties) Accept(v Visitor) (node Node, ok bool)
func (*LabelsAndProperties) OriginTextPosition ¶
func (n *LabelsAndProperties) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*LabelsAndProperties) Restore ¶
func (l *LabelsAndProperties) Restore(ctx *format.RestoreCtx) error
func (*LabelsAndProperties) SetOriginTextPosition ¶
func (n *LabelsAndProperties) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type LimitClause ¶
type LimitClause struct { Count ExprNode Offset ExprNode // contains filtered or unexported fields }
LimitClause is the limit clause.
func (*LimitClause) Accept ¶
func (n *LimitClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*LimitClause) OriginTextPosition ¶
func (n *LimitClause) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*LimitClause) Restore ¶
func (n *LimitClause) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*LimitClause) SetOriginTextPosition ¶
func (n *LimitClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type MatchClause ¶
type MatchClause struct { Graph model.CIStr Paths []*PathPattern // contains filtered or unexported fields }
func (*MatchClause) OriginTextPosition ¶
func (n *MatchClause) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*MatchClause) Restore ¶
func (n *MatchClause) Restore(ctx *format.RestoreCtx) error
func (*MatchClause) SetOriginTextPosition ¶
func (n *MatchClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type MatchClauseList ¶
type MatchClauseList struct { Matches []*MatchClause // contains filtered or unexported fields }
func (*MatchClauseList) OriginTextPosition ¶
func (n *MatchClauseList) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*MatchClauseList) Restore ¶
func (n *MatchClauseList) Restore(ctx *format.RestoreCtx) error
func (*MatchClauseList) SetOriginTextPosition ¶
func (n *MatchClauseList) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type Node ¶
type Node interface { // Restore returns the sql text from ast tree Restore(ctx *format.RestoreCtx) error // Accept accepts Visitor to visit itself. // The returned node should replace original node. // ok returns false to stop visiting. // // Implementation of this method should first call visitor.Enter, // assign the returned node to its method receiver, if skipChildren returns true, // children should be skipped. Otherwise, call its children in particular order that // later elements depends on former elements. Finally, return visitor.Leave. Accept(v Visitor) (node Node, ok bool) // Text returns the original text of the element. Text() string // SetText sets original text to the Node. SetText(text string) // SetOriginTextPosition set the start offset of this node in the origin text. SetOriginTextPosition(offset int) // OriginTextPosition get the start offset of this node in the origin text. OriginTextPosition() int }
Node is the basic element of the AST. Interfaces embed Node should have 'Node' name suffix.
type OrderByClause ¶
type OrderByClause struct { Items []*ByItem // contains filtered or unexported fields }
OrderByClause represents order by clause.
func (*OrderByClause) Accept ¶
func (n *OrderByClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*OrderByClause) OriginTextPosition ¶
func (n *OrderByClause) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*OrderByClause) Restore ¶
func (n *OrderByClause) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*OrderByClause) SetOriginTextPosition ¶
func (n *OrderByClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type ParenthesesExpr ¶
type ParenthesesExpr struct { // Expr is the expression in parentheses. Expr ExprNode // contains filtered or unexported fields }
ParenthesesExpr is the parentheses expression.
func (*ParenthesesExpr) Accept ¶
func (n *ParenthesesExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*ParenthesesExpr) Restore ¶
func (n *ParenthesesExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type PathPattern ¶
type PathPattern struct { Tp PathPatternType TopK int64 Vertices []*VertexPattern Connections []VertexPairConnection // contains filtered or unexported fields }
func (*PathPattern) OriginTextPosition ¶
func (n *PathPattern) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*PathPattern) Restore ¶
func (n *PathPattern) Restore(ctx *format.RestoreCtx) error
func (*PathPattern) SetOriginTextPosition ¶
func (n *PathPattern) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type PathPatternMacro ¶
type PathPatternMacro struct { Name model.CIStr Path *PathPattern Where ExprNode // contains filtered or unexported fields }
func (*PathPatternMacro) OriginTextPosition ¶
func (n *PathPatternMacro) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*PathPatternMacro) Restore ¶
func (n *PathPatternMacro) Restore(ctx *format.RestoreCtx) error
func (*PathPatternMacro) SetOriginTextPosition ¶
func (n *PathPatternMacro) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type PathPatternType ¶
type PathPatternType int
const ( PathPatternSimple PathPatternType = iota PathPatternAny PathPatternAnyShortest PathPatternAllShortest PathPatternTopKShortest PathPatternAnyCheapest PathPatternAllCheapest PathPatternTopKCheapest PathPatternAll )
type PatternInExpr ¶
type PatternInExpr struct { // Expr is the value expression to be compared. Expr ExprNode // List is the list expression in compare list. List []ExprNode // Not is true, the expression is "not in". Not bool // contains filtered or unexported fields }
PatternInExpr is the expression for in operator, like "expr in (1, 2, 3)" or "expr in (select c from t)".
func (*PatternInExpr) Accept ¶
func (n *PatternInExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*PatternInExpr) Restore ¶
func (n *PatternInExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type PatternQuantifier ¶
type PatternQuantifier struct { Tp PatternQuantifierType N int64 M int64 // contains filtered or unexported fields }
func (*PatternQuantifier) OriginTextPosition ¶
func (n *PatternQuantifier) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*PatternQuantifier) Restore ¶
func (n *PatternQuantifier) Restore(ctx *format.RestoreCtx) error
func (*PatternQuantifier) SetOriginTextPosition ¶
func (n *PatternQuantifier) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type PatternQuantifierType ¶
type PatternQuantifierType int
type PropertyAccess ¶
type PropertyAccess struct { VariableName model.CIStr PropertyName model.CIStr // contains filtered or unexported fields }
func (*PropertyAccess) Restore ¶
func (n *PropertyAccess) Restore(ctx *format.RestoreCtx) error
type PropertyAssignment ¶
type PropertyAssignment struct { PropertyAccess *PropertyAccess ValueExpression ExprNode // contains filtered or unexported fields }
func (*PropertyAssignment) Accept ¶
func (p *PropertyAssignment) Accept(v Visitor) (node Node, ok bool)
func (*PropertyAssignment) OriginTextPosition ¶
func (n *PropertyAssignment) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*PropertyAssignment) Restore ¶
func (p *PropertyAssignment) Restore(ctx *format.RestoreCtx) error
func (*PropertyAssignment) SetOriginTextPosition ¶
func (n *PropertyAssignment) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type QuantifiedPathExpr ¶
type QuantifiedPathExpr struct { Edge *EdgePattern Quantifier *PatternQuantifier Source *VertexPattern Destination *VertexPattern Where ExprNode Cost ExprNode // contains filtered or unexported fields }
func (*QuantifiedPathExpr) OriginTextPosition ¶
func (n *QuantifiedPathExpr) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*QuantifiedPathExpr) Restore ¶
func (n *QuantifiedPathExpr) Restore(ctx *format.RestoreCtx) error
func (*QuantifiedPathExpr) SetOriginTextPosition ¶
func (n *QuantifiedPathExpr) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type ReachabilityPathExpr ¶
type ReachabilityPathExpr struct { Labels []model.CIStr Direction EdgeDirection Quantifier *PatternQuantifier // Variable name is not supported in ReachabilityPathExpr. // But we need an anonymous name for building logical plan. AnonymousName model.CIStr // Macros will be assigned in MacroExpansion stage. // LabelName(lower) -> PathPattern Macros map[string]*PathPattern // contains filtered or unexported fields }
func (*ReachabilityPathExpr) OriginTextPosition ¶
func (n *ReachabilityPathExpr) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*ReachabilityPathExpr) Restore ¶
func (n *ReachabilityPathExpr) Restore(ctx *format.RestoreCtx) error
func (*ReachabilityPathExpr) SetOriginTextPosition ¶
func (n *ReachabilityPathExpr) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type RollbackStmt ¶
type RollbackStmt struct {
// contains filtered or unexported fields
}
func (*RollbackStmt) OriginTextPosition ¶
func (n *RollbackStmt) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*RollbackStmt) Restore ¶
func (r *RollbackStmt) Restore(ctx *format.RestoreCtx) error
func (*RollbackStmt) SetOriginTextPosition ¶
func (n *RollbackStmt) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type SelectClause ¶
type SelectClause struct { Star bool Distinct bool Elements []*SelectElement // contains filtered or unexported fields }
func (*SelectClause) OriginTextPosition ¶
func (n *SelectClause) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*SelectClause) Restore ¶
func (n *SelectClause) Restore(ctx *format.RestoreCtx) error
func (*SelectClause) SetOriginTextPosition ¶
func (n *SelectClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type SelectElement ¶
type SelectElement struct { ExpAsVar *ExpAsVar // All Properties with optional prefix Identifier string Prefix string // contains filtered or unexported fields }
SelectElement represents a result field which can be a property from a label, or an expression in select field. It is a generated property during binding process. SelectElement is the key element to evaluate a PropertyNameExpr.
func (*SelectElement) OriginTextPosition ¶
func (n *SelectElement) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*SelectElement) Restore ¶
func (n *SelectElement) Restore(ctx *format.RestoreCtx) error
func (*SelectElement) SetOriginTextPosition ¶
func (n *SelectElement) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type SelectStmt ¶
type SelectStmt struct { PathPatternMacros []*PathPatternMacro Select *SelectClause From *MatchClauseList Where ExprNode GroupBy *GroupByClause Having *HavingClause OrderBy *OrderByClause Limit *LimitClause // contains filtered or unexported fields }
func (*SelectStmt) Restore ¶
func (n *SelectStmt) Restore(ctx *format.RestoreCtx) error
type ShowStmt ¶
type ShowStmt struct { Tp ShowTarget GraphName model.CIStr // contains filtered or unexported fields }
type ShowTarget ¶
type ShowTarget byte
const ( ShowTargetGraphs ShowTarget = iota + 1 ShowTargetLabels )
type StmtNode ¶
type StmtNode interface { Node // contains filtered or unexported methods }
StmtNode represents statement node. Name of implementations should have 'Stmt' suffix.
type SubqueryExpr ¶
type SubqueryExpr struct { // Query is the query SelectNode. Query *SelectStmt Evaluated bool MultiRows bool Exists bool // contains filtered or unexported fields }
SubqueryExpr represents a subquery.
func (*SubqueryExpr) Accept ¶
func (n *SubqueryExpr) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*SubqueryExpr) Restore ¶
func (n *SubqueryExpr) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
type SubstrFuncExpr ¶
type SubstrFuncExpr struct { Expr ExprNode Start ExprNode For ExprNode // contains filtered or unexported fields }
SubstrFuncExpr is for function expression.
func (*SubstrFuncExpr) Restore ¶
func (s *SubstrFuncExpr) Restore(ctx *format.RestoreCtx) error
type UnaryExpr ¶
type UnaryExpr struct { // Op is the operator opcode. Op opcode.Op // V is the unary expression. V ExprNode // contains filtered or unexported fields }
UnaryExpr is the expression for unary operator.
type UpdateStmt ¶
type UpdateStmt struct { PathPatternMacros []*PathPatternMacro Updates []*GraphElementUpdate // Full modify query // ref: https://pgql-lang.org/spec/1.5/#insert From *MatchClauseList Where ExprNode GroupBy *GroupByClause Having *HavingClause OrderBy *OrderByClause Limit *LimitClause // contains filtered or unexported fields }
func (*UpdateStmt) Restore ¶
func (n *UpdateStmt) Restore(ctx *format.RestoreCtx) error
type ValueExpr ¶
ValueExpr is the simple value expression.
func NewValueExpr ¶
func NewValueExpr(lit interface{}) *ValueExpr
NewValueExpr creates a ValueExpr with value, and sets default field type.
type VariableReference ¶
type VariableReference struct { VariableName model.CIStr // contains filtered or unexported fields }
func (*VariableReference) Accept ¶
func (n *VariableReference) Accept(v Visitor) (node Node, ok bool)
func (*VariableReference) Restore ¶
func (n *VariableReference) Restore(ctx *format.RestoreCtx) error
type VariableSpec ¶
type VariableSpec struct { Name model.CIStr Labels []model.CIStr Anonymous bool // contains filtered or unexported fields }
func (*VariableSpec) OriginTextPosition ¶
func (n *VariableSpec) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*VariableSpec) Restore ¶
func (n *VariableSpec) Restore(ctx *format.RestoreCtx) error
func (*VariableSpec) SetOriginTextPosition ¶
func (n *VariableSpec) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type VertexPairConnection ¶
type VertexPairConnection interface { Node // contains filtered or unexported methods }
type VertexPattern ¶
type VertexPattern struct { Variable *VariableSpec // contains filtered or unexported fields }
func (*VertexPattern) OriginTextPosition ¶
func (n *VertexPattern) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*VertexPattern) Restore ¶
func (n *VertexPattern) Restore(ctx *format.RestoreCtx) error
func (*VertexPattern) SetOriginTextPosition ¶
func (n *VertexPattern) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.
type Visitor ¶
type Visitor interface { // Enter is called before children nodes are visited. // The returned node must be the same type as the input node n. // skipChildren returns true means children nodes should be skipped, // this is useful when work is done in Enter and there is no need to visit children. Enter(n Node) (node Node, skipChildren bool) // Leave is called after children nodes have been visited. // The returned node's type can be different from the input node if it is a ExprNode, // Non-expression node must be the same type as the input node n. // ok returns false to stop visiting. Leave(n Node) (node Node, ok bool) }
Visitor visits a Node.
type WhenClause ¶
type WhenClause struct { // Expr is the condition expression in WhenClause. Expr ExprNode // Result is the result expression in WhenClause. Result ExprNode // contains filtered or unexported fields }
WhenClause is the when clause in Case expression for "when condition then result".
func (*WhenClause) Accept ¶
func (n *WhenClause) Accept(v Visitor) (Node, bool)
Accept implements Node Accept interface.
func (*WhenClause) OriginTextPosition ¶
func (n *WhenClause) OriginTextPosition() int
OriginTextPosition implements Node interface.
func (*WhenClause) Restore ¶
func (n *WhenClause) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*WhenClause) SetOriginTextPosition ¶
func (n *WhenClause) SetOriginTextPosition(offset int)
SetOriginTextPosition implements Node interface.