Skip to content

Commit 9725070

Browse files
authored
Add Explain function for AST to EXPLAIN AST output (#6)
1 parent 898e780 commit 9725070

7 files changed

Lines changed: 1838 additions & 11 deletions

File tree

ast/ast.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,10 @@ func (c *Constraint) End() token.Position { return c.Position }
290290

291291
// EngineClause represents an ENGINE clause.
292292
type EngineClause struct {
293-
Position token.Position `json:"-"`
294-
Name string `json:"name"`
295-
Parameters []Expression `json:"parameters,omitempty"`
293+
Position token.Position `json:"-"`
294+
Name string `json:"name"`
295+
Parameters []Expression `json:"parameters,omitempty"`
296+
HasParentheses bool `json:"has_parentheses,omitempty"` // true if called with ()
296297
}
297298

298299
func (e *EngineClause) Pos() token.Position { return e.Position }
@@ -781,10 +782,11 @@ func (w *WhenClause) End() token.Position { return w.Position }
781782

782783
// CastExpr represents a CAST expression.
783784
type CastExpr struct {
784-
Position token.Position `json:"-"`
785-
Expr Expression `json:"expr"`
786-
Type *DataType `json:"type"`
787-
Alias string `json:"alias,omitempty"`
785+
Position token.Position `json:"-"`
786+
Expr Expression `json:"expr"`
787+
Type *DataType `json:"type"`
788+
Alias string `json:"alias,omitempty"`
789+
OperatorSyntax bool `json:"operator_syntax,omitempty"` // true if using :: syntax
788790
}
789791

790792
func (c *CastExpr) Pos() token.Position { return c.Position }

0 commit comments

Comments
 (0)