Documentation ¶
Overview ¶
Copyright 2021 Molecula Corp. All rights reserved.
Copyright 2021 Molecula Corp. All rights reserved.
Copyright 2021 Molecula Corp. All rights reserved.
Copyright 2021 Molecula Corp. All rights reserved.
Copyright 2021 Molecula Corp. All rights reserved.
Index ¶
- Constants
- func ExprString(expr Expr) string
- func ForEachSource(src Source, fn func(Source) bool)
- func IdentName(ident *Ident) string
- func IsInteger(s string) bool
- func IsValidTypeName(typeName string) bool
- func NumDecimalPlaces(v string) int
- type AlterTableStatement
- type AlterViewStatement
- type AnalyzeStatement
- type Assignment
- type BeginStatement
- type BinaryExpr
- type BoolLit
- type BulkInsertMapDefinition
- type BulkInsertStatement
- type CTE
- type CacheTypeConstraint
- type Call
- type CaseBlock
- type CaseExpr
- type CastExpr
- type CheckConstraint
- type ColumnArg
- type ColumnDefinition
- type CommentOption
- type CommitStatement
- type Constraint
- type CreateFunctionStatement
- type CreateIndexStatement
- type CreateTableStatement
- type CreateViewStatement
- type DataTypeBool
- type DataTypeDecimal
- type DataTypeID
- type DataTypeIDSet
- type DataTypeIDSetQuantum
- type DataTypeInt
- type DataTypeRange
- type DataTypeString
- type DataTypeStringSet
- type DataTypeStringSetQuantum
- type DataTypeSubtable
- type DataTypeTimestamp
- type DataTypeTuple
- type DataTypeVoid
- type DateLit
- type DefaultConstraint
- type DeleteStatement
- type DropFunctionStatement
- type DropIndexStatement
- type DropTableStatement
- type DropViewStatement
- type Error
- type Exists
- type ExplainStatement
- type Expr
- type ExprDataType
- type ExprList
- type FilterClause
- type FloatLit
- type ForeignKeyArg
- type ForeignKeyConstraint
- type FrameSpec
- type Ident
- type IndexedColumn
- type InsertStatement
- type IntegerLit
- type JoinClause
- func (c *JoinClause) Clone() *JoinClause
- func (c *JoinClause) OutputColumnNamed(name string) (*SourceOutputColumn, error)
- func (c *JoinClause) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
- func (c *JoinClause) PossibleOutputColumns() []*SourceOutputColumn
- func (c *JoinClause) SourceFromAlias(alias string) Source
- func (c *JoinClause) String() string
- type JoinConstraint
- type JoinOperator
- type KeyPartitionsOption
- type MaxConstraint
- type MinConstraint
- type Node
- type NotNullConstraint
- type NullLit
- type OnConstraint
- type OrderingTerm
- type OverClause
- type ParameterDefinition
- type ParenExpr
- type ParenSource
- func (s *ParenSource) Clone() *ParenSource
- func (c *ParenSource) OutputColumnNamed(name string) (*SourceOutputColumn, error)
- func (c *ParenSource) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
- func (c *ParenSource) PossibleOutputColumns() []*SourceOutputColumn
- func (c *ParenSource) SourceFromAlias(alias string) Source
- func (s *ParenSource) String() string
- type Parser
- type Pos
- type PrimaryKeyConstraint
- type QualifiedRef
- type QualifiedTableName
- func (n *QualifiedTableName) Clone() *QualifiedTableName
- func (n *QualifiedTableName) MatchesTablenameOrAlias(match string) bool
- func (c *QualifiedTableName) OutputColumnNamed(name string) (*SourceOutputColumn, error)
- func (c *QualifiedTableName) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
- func (c *QualifiedTableName) PossibleOutputColumns() []*SourceOutputColumn
- func (c *QualifiedTableName) SourceFromAlias(alias string) Source
- func (n *QualifiedTableName) String() string
- func (n *QualifiedTableName) TableName() string
- type Range
- type ReleaseStatement
- type ResultColumn
- type RollbackStatement
- type SavepointStatement
- type Scanner
- type SelectStatement
- func (s *SelectStatement) Clone() *SelectStatement
- func (s *SelectStatement) DataType() ExprDataType
- func (s *SelectStatement) HasWildcard() bool
- func (expr *SelectStatement) IsLiteral() bool
- func (c *SelectStatement) OutputColumnNamed(name string) (*SourceOutputColumn, error)
- func (c *SelectStatement) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
- func (s *SelectStatement) Pos() Pos
- func (c *SelectStatement) PossibleOutputColumns() []*SourceOutputColumn
- func (c *SelectStatement) SourceFromAlias(alias string) Source
- func (s *SelectStatement) String() string
- type SetLiteralExpr
- type ShowColumnsStatement
- type ShowCreateTableStatement
- type ShowTablesStatement
- type Source
- type SourceOutputColumn
- type Statement
- type StringLit
- type SubtableColumn
- type TableOption
- type TableValuedFunction
- func (n *TableValuedFunction) Clone() *TableValuedFunction
- func (n *TableValuedFunction) MatchesTablenameOrAlias(match string) bool
- func (c *TableValuedFunction) OutputColumnNamed(name string) (*SourceOutputColumn, error)
- func (c *TableValuedFunction) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
- func (c *TableValuedFunction) PossibleOutputColumns() []*SourceOutputColumn
- func (c *TableValuedFunction) SourceFromAlias(alias string) Source
- func (n *TableValuedFunction) String() string
- func (n *TableValuedFunction) TableName() string
- type TimeQuantumConstraint
- type TimeUnitConstraint
- type Token
- type TupleLiteralExpr
- type Type
- type UnaryExpr
- type UniqueConstraint
- type UpdateStatement
- type UpsertClause
- type UsingConstraint
- type Variable
- type VisitEndFunc
- type VisitFunc
- type Visitor
- type Window
- type WindowDefinition
- type WithClause
Constants ¶
const ( LowestPrec = 0 // non-operators UnaryPrec = 13 HighestPrec = 14 )
Variables ¶
This section is empty.
Functions ¶
func ExprString ¶
ExprString returns the string representation of expr. Returns a blank string if expr is nil.
func ForEachSource ¶
ForEachSource calls fn for every source within the current scope. Stops iteration if fn returns false.
func IsValidTypeName ¶
func NumDecimalPlaces ¶
Types ¶
type AlterTableStatement ¶
type AlterTableStatement struct { Alter Pos // position of ALTER keyword Table Pos // position of TABLE keyword Name *Ident // table name Rename Pos // position of RENAME keyword RenameColumn Pos // position of COLUMN keyword after RENAME OldColumnName *Ident // old column name To Pos // position of TO keyword NewColumnName *Ident // new column name Add Pos // position of ADD keyword AddColumn Pos // position of COLUMN keyword after ADD ColumnDef *ColumnDefinition // new column definition Drop Pos // position of ADD keyword DropColumn Pos // position of COLUMN keyword after ADD DropColumnName *Ident // drop column name }
func (*AlterTableStatement) Clone ¶
func (s *AlterTableStatement) Clone() *AlterTableStatement
Clone returns a deep copy of s.
func (*AlterTableStatement) String ¶
func (s *AlterTableStatement) String() string
String returns the string representation of the statement.
type AlterViewStatement ¶ added in v3.29.0
type AlterViewStatement struct { Alter Pos // position of CREATE keyword View Pos // position of VIEW keyword Name *Ident // view name // TODO(pok) - we'll do this later - see note in parseCompileView() // Lparen Pos // position of column list left paren // Columns []*Ident // column list // Rparen Pos // position of column list right paren As Pos // position of AS keyword Select *SelectStatement // source statement }
func (*AlterViewStatement) Clone ¶ added in v3.29.0
func (s *AlterViewStatement) Clone() *AlterViewStatement
Clone returns a deep copy of s.
func (*AlterViewStatement) String ¶ added in v3.29.0
func (s *AlterViewStatement) String() string
String returns the string representation of the statement.
type AnalyzeStatement ¶
type AnalyzeStatement struct { Analyze Pos // position of ANALYZE keyword Name *Ident // table name }
func (*AnalyzeStatement) Clone ¶
func (s *AnalyzeStatement) Clone() *AnalyzeStatement
Clone returns a deep copy of s.
func (*AnalyzeStatement) String ¶
func (s *AnalyzeStatement) String() string
String returns the string representation of the statement.
type Assignment ¶
type Assignment struct { Lparen Pos // position of column list left paren Columns []*Ident // column list Rparen Pos // position of column list right paren Eq Pos // position of = Expr Expr // assigned expression }
Assignment is used within the UPDATE statement & upsert clause. It is similiar to an expression except that it must be an equality.
func (*Assignment) String ¶
func (a *Assignment) String() string
String returns the string representation of the clause.
type BeginStatement ¶
type BeginStatement struct { Begin Pos // position of BEGIN Deferred Pos // position of DEFERRED keyword Immediate Pos // position of IMMEDIATE keyword Exclusive Pos // position of EXCLUSIVE keyword Transaction Pos // position of TRANSACTION keyword (optional) }
func (*BeginStatement) Clone ¶
func (s *BeginStatement) Clone() *BeginStatement
Clone returns a deep copy of s.
func (*BeginStatement) String ¶
func (s *BeginStatement) String() string
String returns the string representation of the statement.
type BinaryExpr ¶
type BinaryExpr struct { X Expr // lhs OpPos Pos // position of Op Op Token // operator Y Expr // rhs ResultDataType ExprDataType }
func (*BinaryExpr) Clone ¶
func (expr *BinaryExpr) Clone() *BinaryExpr
Clone returns a deep copy of expr.
func (*BinaryExpr) DataType ¶
func (expr *BinaryExpr) DataType() ExprDataType
func (*BinaryExpr) IsLiteral ¶
func (expr *BinaryExpr) IsLiteral() bool
func (*BinaryExpr) Pos ¶
func (expr *BinaryExpr) Pos() Pos
func (*BinaryExpr) String ¶
func (expr *BinaryExpr) String() string
String returns the string representation of the expression.
type BulkInsertMapDefinition ¶
type BulkInsertMapDefinition struct { Name *Ident // map name Type *Type // data type MapExpr Expr }
func (*BulkInsertMapDefinition) Clone ¶
func (d *BulkInsertMapDefinition) Clone() *BulkInsertMapDefinition
Clone returns a deep copy of d.
func (*BulkInsertMapDefinition) String ¶
func (c *BulkInsertMapDefinition) String() string
String returns the string representation of the statement.
type BulkInsertStatement ¶
type BulkInsertStatement struct { Bulk Pos // position of BULK keyword Insert Pos // position of INSERT keyword Replace Pos // position of REPLACE keyword Into Pos // position of INTO keyword Table *Ident // table name ColumnsLparen Pos // position of column list left paren Columns []*Ident // optional column list ColumnsRparen Pos // position of column list right paren Map Pos // position of MAP keyword MapLparen Pos // position of column list left paren MapList []*BulkInsertMapDefinition // source to column map MapRparen Pos // position of column list right paren Transform Pos // position of MAP keyword TransformLparen Pos // position of column list left paren TransformList []Expr // source to column map TransformRparen Pos // position of column list right paren From Pos // position of FROM keyword DataSource Expr // data source With Pos // position of WITH keyword BatchSize Expr RowsLimit Expr Format Expr Input Expr HeaderRow Expr // has header row (that needs to be skipped) AllowMissingValues Expr // allows missing values }
func (*BulkInsertStatement) String ¶
func (s *BulkInsertStatement) String() string
type CTE ¶
type CTE struct { TableName *Ident // table name ColumnsLparen Pos // position of column list left paren Columns []*Ident // optional column list ColumnsRparen Pos // position of column list right paren As Pos // position of AS keyword SelectLparen Pos // position of select left paren Select *SelectStatement // select statement SelectRparen Pos // position of select right paren }
CTE represents an AST node for a common table expression.
type CacheTypeConstraint ¶
type CacheTypeConstraint struct { CacheType Pos // position of CACHETYPE keyword CacheTypeValue string Size Pos // position of SIZE keyword SizeExpr Expr // check expression }
func (*CacheTypeConstraint) Clone ¶
func (c *CacheTypeConstraint) Clone() *CacheTypeConstraint
Clone returns a deep copy of c.
func (*CacheTypeConstraint) String ¶
func (c *CacheTypeConstraint) String() string
String returns the string representation of the constraint.
type Call ¶
type Call struct { Name *Ident // function name Lparen Pos // position of left paren Star Pos // position of * Distinct Pos // position of DISTINCT keyword Args []Expr // argument list Rparen Pos // position of right paren Filter *FilterClause // filter clause Over *OverClause // over clause ResultDataType ExprDataType }
func (*Call) DataType ¶
func (expr *Call) DataType() ExprDataType
type CaseBlock ¶
type CaseBlock struct { When Pos // position of WHEN keyword Condition Expr // block condition Then Pos // position of THEN keyword Body Expr // result expression }
func (*CaseBlock) DataType ¶
func (expr *CaseBlock) DataType() ExprDataType
type CaseExpr ¶
type CaseExpr struct { Case Pos // position of CASE keyword Operand Expr // optional condition after the CASE keyword Blocks []*CaseBlock // list of WHEN/THEN pairs Else Pos // position of ELSE keyword ElseExpr Expr // expression used by default case End Pos // position of END keyword ResultDataType ExprDataType }
func (*CaseExpr) DataType ¶
func (expr *CaseExpr) DataType() ExprDataType
type CastExpr ¶
type CastExpr struct { Cast Pos // position of CAST keyword Lparen Pos // position of left paren X Expr // target expression As Pos // position of AS keyword Type *Type // cast type Rparen Pos // position of right paren ResultDataType ExprDataType }
func (*CastExpr) DataType ¶
func (expr *CastExpr) DataType() ExprDataType
type CheckConstraint ¶
type CheckConstraint struct { Constraint Pos // position of CONSTRAINT keyword Name *Ident // constraint name Check Pos // position of UNIQUE keyword Lparen Pos // position of left paren Expr Expr // check expression Rparen Pos // position of right paren }
func (*CheckConstraint) Clone ¶
func (c *CheckConstraint) Clone() *CheckConstraint
Clone returns a deep copy of c.
func (*CheckConstraint) String ¶
func (c *CheckConstraint) String() string
String returns the string representation of the constraint.
type ColumnDefinition ¶
type ColumnDefinition struct { Name *Ident // column name Type *Type // data type Constraints []Constraint // column constraints }
func (*ColumnDefinition) Clone ¶
func (d *ColumnDefinition) Clone() *ColumnDefinition
Clone returns a deep copy of d.
func (*ColumnDefinition) String ¶
func (c *ColumnDefinition) String() string
String returns the string representation of the statement.
type CommentOption ¶
func (*CommentOption) String ¶
func (o *CommentOption) String() string
type CommitStatement ¶
type CommitStatement struct { Commit Pos // position of COMMIT keyword End Pos // position of END keyword Transaction Pos // position of TRANSACTION keyword (optional) }
func (*CommitStatement) Clone ¶
func (s *CommitStatement) Clone() *CommitStatement
Clone returns a deep copy of s.
func (*CommitStatement) String ¶
func (s *CommitStatement) String() string
String returns the string representation of the statement.
type Constraint ¶
type Constraint interface { Node // contains filtered or unexported methods }
func CloneConstraint ¶
func CloneConstraint(cons Constraint) Constraint
CloneConstraint returns a deep copy cons.
type CreateFunctionStatement ¶
type CreateFunctionStatement struct { Create Pos // position of CREATE keyword Function Pos // position of FUNCTION keyword If Pos // position of IF keyword IfNot Pos // position of NOT keyword after IF IfNotExists Pos // position of EXISTS keyword after IF NOT Name *Ident // index name Lparen Pos // position of parameter LParen Parameters []*ParameterDefinition // parameters Rparen Pos // position of parameter RParen Returns Pos // position of RETURNS keyword ReturnDef *ParameterDefinition // return def As Pos // position of AS keyword Begin Pos // position of BEGIN keyword Body []Statement // function body End Pos // position of END keyword }
func (*CreateFunctionStatement) Clone ¶
func (s *CreateFunctionStatement) Clone() *CreateFunctionStatement
Clone returns a deep copy of s.
func (*CreateFunctionStatement) String ¶
func (s *CreateFunctionStatement) String() string
String returns the string representation of the statement.
type CreateIndexStatement ¶
type CreateIndexStatement struct { Create Pos // position of CREATE keyword Unique Pos // position of optional UNIQUE keyword Index Pos // position of INDEX keyword If Pos // position of IF keyword IfNot Pos // position of NOT keyword after IF IfNotExists Pos // position of EXISTS keyword after IF NOT Name *Ident // index name On Pos // position of ON keyword Table *Ident // index name Lparen Pos // position of column list left paren Columns []*IndexedColumn // column list Rparen Pos // position of column list right paren Where Pos // position of WHERE keyword WhereExpr Expr // conditional expression }
func (*CreateIndexStatement) Clone ¶
func (s *CreateIndexStatement) Clone() *CreateIndexStatement
Clone returns a deep copy of s.
func (*CreateIndexStatement) String ¶
func (s *CreateIndexStatement) String() string
String returns the string representation of the statement.
type CreateTableStatement ¶
type CreateTableStatement struct { Create Pos // position of CREATE keyword Table Pos // position of CREATE keyword If Pos // position of IF keyword (optional) IfNot Pos // position of NOT keyword (optional) IfNotExists Pos // position of EXISTS keyword (optional) Name *Ident // table name Lparen Pos // position of left paren of column list Columns []*ColumnDefinition // column definitions Constraints []Constraint // table constraints Rparen Pos // position of right paren of column list As Pos // position of AS keyword (optional) Select *SelectStatement // select stmt to build from Options []TableOption // table options }
func (*CreateTableStatement) Clone ¶
func (s *CreateTableStatement) Clone() *CreateTableStatement
Clone returns a deep copy of s.
func (*CreateTableStatement) String ¶
func (s *CreateTableStatement) String() string
String returns the string representation of the statement.
type CreateViewStatement ¶
type CreateViewStatement struct { Create Pos // position of CREATE keyword View Pos // position of VIEW keyword If Pos // position of IF keyword IfNot Pos // position of NOT keyword after IF IfNotExists Pos // position of EXISTS keyword after IF NOT Name *Ident // view name // TODO(pok) - we'll do this later - see note in parseCompileView() // Lparen Pos // position of column list left paren // Columns []*Ident // column list // Rparen Pos // position of column list right paren As Pos // position of AS keyword Select *SelectStatement // source statement }
func (*CreateViewStatement) Clone ¶
func (s *CreateViewStatement) Clone() *CreateViewStatement
Clone returns a deep copy of s.
func (*CreateViewStatement) String ¶
func (s *CreateViewStatement) String() string
String returns the string representation of the statement.
type DataTypeBool ¶
type DataTypeBool struct { }
func NewDataTypeBool ¶
func NewDataTypeBool() *DataTypeBool
func (*DataTypeBool) BaseTypeName ¶
func (*DataTypeBool) BaseTypeName() string
func (*DataTypeBool) TypeDescription ¶
func (dt *DataTypeBool) TypeDescription() string
func (*DataTypeBool) TypeInfo ¶
func (*DataTypeBool) TypeInfo() map[string]interface{}
type DataTypeDecimal ¶
type DataTypeDecimal struct {
Scale int64
}
func NewDataTypeDecimal ¶
func NewDataTypeDecimal(scale int64) *DataTypeDecimal
func (*DataTypeDecimal) BaseTypeName ¶
func (d *DataTypeDecimal) BaseTypeName() string
func (*DataTypeDecimal) TypeDescription ¶
func (d *DataTypeDecimal) TypeDescription() string
func (*DataTypeDecimal) TypeInfo ¶
func (d *DataTypeDecimal) TypeInfo() map[string]interface{}
type DataTypeID ¶
type DataTypeID struct { }
func NewDataTypeID ¶
func NewDataTypeID() *DataTypeID
func (*DataTypeID) BaseTypeName ¶
func (*DataTypeID) BaseTypeName() string
func (*DataTypeID) TypeDescription ¶
func (dt *DataTypeID) TypeDescription() string
func (*DataTypeID) TypeInfo ¶
func (*DataTypeID) TypeInfo() map[string]interface{}
type DataTypeIDSet ¶
type DataTypeIDSet struct { }
func NewDataTypeIDSet ¶
func NewDataTypeIDSet() *DataTypeIDSet
func (*DataTypeIDSet) BaseTypeName ¶
func (*DataTypeIDSet) BaseTypeName() string
func (*DataTypeIDSet) TypeDescription ¶
func (dt *DataTypeIDSet) TypeDescription() string
func (*DataTypeIDSet) TypeInfo ¶
func (*DataTypeIDSet) TypeInfo() map[string]interface{}
type DataTypeIDSetQuantum ¶
type DataTypeIDSetQuantum struct { }
TODO (pok) should time quantum be it's own type and not a constraint?
func NewDataTypeIDSetQuantum ¶
func NewDataTypeIDSetQuantum() *DataTypeIDSetQuantum
func (*DataTypeIDSetQuantum) BaseTypeName ¶
func (*DataTypeIDSetQuantum) BaseTypeName() string
func (*DataTypeIDSetQuantum) TypeDescription ¶
func (dt *DataTypeIDSetQuantum) TypeDescription() string
func (*DataTypeIDSetQuantum) TypeInfo ¶
func (*DataTypeIDSetQuantum) TypeInfo() map[string]interface{}
type DataTypeInt ¶
type DataTypeInt struct { }
func NewDataTypeInt ¶
func NewDataTypeInt() *DataTypeInt
func (*DataTypeInt) BaseTypeName ¶
func (*DataTypeInt) BaseTypeName() string
func (*DataTypeInt) TypeDescription ¶
func (dt *DataTypeInt) TypeDescription() string
func (*DataTypeInt) TypeInfo ¶
func (*DataTypeInt) TypeInfo() map[string]interface{}
type DataTypeRange ¶
type DataTypeRange struct {
SubscriptType ExprDataType
}
func NewDataTypeRange ¶
func NewDataTypeRange(subscriptType ExprDataType) *DataTypeRange
func (*DataTypeRange) BaseTypeName ¶
func (dt *DataTypeRange) BaseTypeName() string
func (*DataTypeRange) TypeDescription ¶
func (dt *DataTypeRange) TypeDescription() string
func (*DataTypeRange) TypeInfo ¶
func (*DataTypeRange) TypeInfo() map[string]interface{}
type DataTypeString ¶
type DataTypeString struct { }
func NewDataTypeString ¶
func NewDataTypeString() *DataTypeString
func (*DataTypeString) BaseTypeName ¶
func (*DataTypeString) BaseTypeName() string
func (*DataTypeString) TypeDescription ¶
func (dt *DataTypeString) TypeDescription() string
func (*DataTypeString) TypeInfo ¶
func (*DataTypeString) TypeInfo() map[string]interface{}
type DataTypeStringSet ¶
type DataTypeStringSet struct { }
func NewDataTypeStringSet ¶
func NewDataTypeStringSet() *DataTypeStringSet
func (*DataTypeStringSet) BaseTypeName ¶
func (*DataTypeStringSet) BaseTypeName() string
func (*DataTypeStringSet) TypeDescription ¶
func (dt *DataTypeStringSet) TypeDescription() string
func (*DataTypeStringSet) TypeInfo ¶
func (*DataTypeStringSet) TypeInfo() map[string]interface{}
type DataTypeStringSetQuantum ¶
type DataTypeStringSetQuantum struct { }
func NewDataTypeStringSetQuantum ¶
func NewDataTypeStringSetQuantum() *DataTypeStringSetQuantum
func (*DataTypeStringSetQuantum) BaseTypeName ¶
func (*DataTypeStringSetQuantum) BaseTypeName() string
func (*DataTypeStringSetQuantum) TypeDescription ¶
func (dt *DataTypeStringSetQuantum) TypeDescription() string
func (*DataTypeStringSetQuantum) TypeInfo ¶
func (*DataTypeStringSetQuantum) TypeInfo() map[string]interface{}
type DataTypeSubtable ¶
type DataTypeSubtable struct {
Columns []*SubtableColumn
}
func NewDataTypeSubtable ¶
func NewDataTypeSubtable(columns []*SubtableColumn) *DataTypeSubtable
func (*DataTypeSubtable) BaseTypeName ¶
func (dt *DataTypeSubtable) BaseTypeName() string
func (*DataTypeSubtable) TypeDescription ¶
func (dt *DataTypeSubtable) TypeDescription() string
func (*DataTypeSubtable) TypeInfo ¶
func (*DataTypeSubtable) TypeInfo() map[string]interface{}
type DataTypeTimestamp ¶
type DataTypeTimestamp struct { }
func NewDataTypeTimestamp ¶
func NewDataTypeTimestamp() *DataTypeTimestamp
func (*DataTypeTimestamp) BaseTypeName ¶
func (*DataTypeTimestamp) BaseTypeName() string
func (*DataTypeTimestamp) TypeDescription ¶
func (dt *DataTypeTimestamp) TypeDescription() string
func (*DataTypeTimestamp) TypeInfo ¶
func (*DataTypeTimestamp) TypeInfo() map[string]interface{}
type DataTypeTuple ¶
type DataTypeTuple struct {
Members []ExprDataType
}
func NewDataTypeTuple ¶
func NewDataTypeTuple(members []ExprDataType) *DataTypeTuple
func (*DataTypeTuple) BaseTypeName ¶
func (dt *DataTypeTuple) BaseTypeName() string
func (*DataTypeTuple) TypeDescription ¶
func (dt *DataTypeTuple) TypeDescription() string
func (*DataTypeTuple) TypeInfo ¶
func (*DataTypeTuple) TypeInfo() map[string]interface{}
type DataTypeVoid ¶
type DataTypeVoid struct { }
func NewDataTypeVoid ¶
func NewDataTypeVoid() *DataTypeVoid
func (*DataTypeVoid) BaseTypeName ¶
func (*DataTypeVoid) BaseTypeName() string
func (*DataTypeVoid) TypeDescription ¶
func (dt *DataTypeVoid) TypeDescription() string
func (*DataTypeVoid) TypeInfo ¶
func (*DataTypeVoid) TypeInfo() map[string]interface{}
type DefaultConstraint ¶
type DefaultConstraint struct { Constraint Pos // position of CONSTRAINT keyword Name *Ident // constraint name Default Pos // position of DEFAULT keyword Lparen Pos // position of left paren Expr Expr // default expression Rparen Pos // position of right paren }
func (*DefaultConstraint) Clone ¶
func (c *DefaultConstraint) Clone() *DefaultConstraint
Clone returns a deep copy of c.
func (*DefaultConstraint) String ¶
func (c *DefaultConstraint) String() string
String returns the string representation of the constraint.
type DeleteStatement ¶
type DeleteStatement struct { // WithClause *WithClause // clause containing CTEs Delete Pos // position of UPDATE keyword From Pos // position of FROM keyword TableName *QualifiedTableName // the name of the table we are deleting from Source Source // source for the delete Where Pos // position of WHERE keyword WhereExpr Expr // conditional expression }
func (*DeleteStatement) Clone ¶
func (s *DeleteStatement) Clone() *DeleteStatement
Clone returns a deep copy of s.
func (*DeleteStatement) String ¶
func (s *DeleteStatement) String() string
String returns the string representation of the clause.
type DropFunctionStatement ¶
type DropFunctionStatement struct { Drop Pos // position of DROP keyword Trigger Pos // position of TRIGGER keyword If Pos // position of IF keyword IfExists Pos // position of EXISTS keyword after IF Name *Ident // trigger name }
func (*DropFunctionStatement) Clone ¶
func (s *DropFunctionStatement) Clone() *DropFunctionStatement
Clone returns a deep copy of s.
func (*DropFunctionStatement) String ¶
func (s *DropFunctionStatement) String() string
type DropIndexStatement ¶
type DropIndexStatement struct { Drop Pos // position of DROP keyword Index Pos // position of INDEX keyword If Pos // position of IF keyword IfExists Pos // position of EXISTS keyword after IF Name *Ident // index name }
func (*DropIndexStatement) Clone ¶
func (s *DropIndexStatement) Clone() *DropIndexStatement
Clone returns a deep copy of s.
func (*DropIndexStatement) String ¶
func (s *DropIndexStatement) String() string
String returns the string representation of the statement.
type DropTableStatement ¶
type DropTableStatement struct { Drop Pos // position of DROP keyword Table Pos // position of TABLE keyword If Pos // position of IF keyword IfExists Pos // position of EXISTS keyword after IF Name *Ident // view name }
func (*DropTableStatement) Clone ¶
func (s *DropTableStatement) Clone() *DropTableStatement
Clone returns a deep copy of s.
func (*DropTableStatement) String ¶
func (s *DropTableStatement) String() string
String returns the string representation of the statement.
type DropViewStatement ¶
type DropViewStatement struct { Drop Pos // position of DROP keyword View Pos // position of VIEW keyword If Pos // position of IF keyword IfExists Pos // position of EXISTS keyword after IF Name *Ident // view name }
func (*DropViewStatement) Clone ¶
func (s *DropViewStatement) Clone() *DropViewStatement
Clone returns a deep copy of s.
func (*DropViewStatement) String ¶
func (s *DropViewStatement) String() string
String returns the string representation of the statement.
type Exists ¶
type Exists struct { Not Pos // position of optional NOT keyword Exists Pos // position of EXISTS keyword Lparen Pos // position of left paren Select *SelectStatement // select statement Rparen Pos // position of right paren }
func (*Exists) DataType ¶
func (expr *Exists) DataType() ExprDataType
type ExplainStatement ¶
type ExplainStatement struct { Explain Pos // position of EXPLAIN Query Pos // position of QUERY (optional) QueryPlan Pos // position of PLAN after QUERY (optional) Stmt Statement // target statement }
func (*ExplainStatement) Clone ¶
func (s *ExplainStatement) Clone() *ExplainStatement
Clone returns a deep copy of s.
func (*ExplainStatement) String ¶
func (s *ExplainStatement) String() string
String returns the string representation of the statement.
type Expr ¶
type Expr interface { Node IsLiteral() bool DataType() ExprDataType Pos() Pos // contains filtered or unexported methods }
func MustParseExprString ¶
MustParseExprString parses s into an expression. Panic on error.
func ParseExprString ¶
ParseExprString parses s into an expression. Returns nil if s is blank.
func SplitExprTree ¶
SplitExprTree splits apart expr so it is a list of all AND joined expressions. For example, the expression "A AND B AND (C OR (D AND E))" would be split into a list of "A", "B", "C OR (D AND E)".
type ExprDataType ¶
type ExprDataType interface { // the base type name e.g. int or decimal BaseTypeName() string // additional type information - intended to be used outside the language // layer (marshalled over json, or otherwise serialized so that consumers // have access to complete type information) // TypeInfo is not used inside the language layer itself, as the concrete // types (e.g. DataTypeString) are used TypeInfo() map[string]interface{} // the full type specification as a string - intended to be human readable TypeDescription() string // contains filtered or unexported methods }
ExprDataType is the interface for all language layer types
type ExprList ¶
type ExprList struct { Lparen Pos // position of left paren Exprs []Expr // list of expressions Rparen Pos // position of right paren }
func (*ExprList) DataType ¶
func (expr *ExprList) DataType() ExprDataType
type FilterClause ¶
type FilterClause struct { Filter Pos // position of FILTER keyword Lparen Pos // position of left paren Where Pos // position of WHERE keyword X Expr // filter expression Rparen Pos // position of right paren }
func (*FilterClause) Clone ¶
func (c *FilterClause) Clone() *FilterClause
Clone returns a deep copy of c.
func (*FilterClause) String ¶
func (c *FilterClause) String() string
String returns the string representation of the clause.
type ForeignKeyArg ¶
type ForeignKeyArg struct { On Pos // position of ON keyword OnUpdate Pos // position of the UPDATE keyword OnDelete Pos // position of the DELETE keyword Set Pos // position of the SET keyword SetNull Pos // position of the NULL keyword after SET SetDefault Pos // position of the DEFAULT keyword after SET Cascade Pos // position of the CASCADE keyword Restrict Pos // position of the RESTRICT keyword No Pos // position of the NO keyword NoAction Pos // position of the ACTION keyword after NO }
func (*ForeignKeyArg) Clone ¶
func (arg *ForeignKeyArg) Clone() *ForeignKeyArg
Clone returns a deep copy of arg.
func (*ForeignKeyArg) String ¶
func (c *ForeignKeyArg) String() string
String returns the string representation of the argument.
type ForeignKeyConstraint ¶
type ForeignKeyConstraint struct { Constraint Pos // position of CONSTRAINT keyword Name *Ident // constraint name Foreign Pos // position of FOREIGN keyword (table only) ForeignKey Pos // position of KEY keyword after FOREIGN (table only) Lparen Pos // position of left paren (table only) Columns []*Ident // indexed columns (table only) Rparen Pos // position of right paren (table only) References Pos // position of REFERENCES keyword ForeignTable *Ident // foreign table name ForeignLparen Pos // position of left paren ForeignColumns []*Ident // column list ForeignRparen Pos // position of right paren Args []*ForeignKeyArg // arguments Deferrable Pos // position of DEFERRABLE keyword Not Pos // position of NOT keyword NotDeferrable Pos // position of DEFERRABLE keyword after NOT Initially Pos // position of INITIALLY keyword InitiallyDeferred Pos // position of DEFERRED keyword after INITIALLY InitiallyImmediate Pos // position of IMMEDIATE keyword after INITIALLY }
func (*ForeignKeyConstraint) Clone ¶
func (c *ForeignKeyConstraint) Clone() *ForeignKeyConstraint
Clone returns a deep copy of c.
func (*ForeignKeyConstraint) String ¶
func (c *ForeignKeyConstraint) String() string
String returns the string representation of the constraint.
type FrameSpec ¶
type FrameSpec struct { Range Pos // position of RANGE keyword Rows Pos // position of ROWS keyword Groups Pos // position of GROUPS keyword Between Pos // position of BETWEEN keyword X Expr // lhs expression UnboundedX Pos // position of lhs UNBOUNDED keyword PrecedingX Pos // position of lhs PRECEDING keyword CurrentX Pos // position of lhs CURRENT keyword CurrentRowX Pos // position of lhs ROW keyword FollowingX Pos // position of lhs FOLLOWING keyword And Pos // position of AND keyword Y Expr // lhs expression UnboundedY Pos // position of rhs UNBOUNDED keyword FollowingY Pos // position of rhs FOLLOWING keyword CurrentY Pos // position of rhs CURRENT keyword CurrentRowY Pos // position of rhs ROW keyword PrecedingY Pos // position of rhs PRECEDING keyword Exclude Pos // position of EXCLUDE keyword ExcludeNo Pos // position of NO keyword after EXCLUDE ExcludeNoOthers Pos // position of OTHERS keyword after EXCLUDE NO ExcludeCurrent Pos // position of CURRENT keyword after EXCLUDE ExcludeCurrentRow Pos // position of ROW keyword after EXCLUDE CURRENT ExcludeGroup Pos // position of GROUP keyword after EXCLUDE ExcludeTies Pos // position of TIES keyword after EXCLUDE }
type Ident ¶
type Ident struct { NamePos Pos // identifier position Name string // identifier name Quoted bool // true if double quoted }
func (*Ident) DataType ¶
func (expr *Ident) DataType() ExprDataType
type IndexedColumn ¶
type IndexedColumn struct { X Expr // column expression Asc Pos // position of optional ASC keyword Desc Pos // position of optional DESC keyword }
func (*IndexedColumn) Clone ¶
func (c *IndexedColumn) Clone() *IndexedColumn
Clone returns a deep copy of c.
func (*IndexedColumn) String ¶
func (c *IndexedColumn) String() string
String returns the string representation of the column.
type InsertStatement ¶
type InsertStatement struct { Insert Pos // position of INSERT keyword Replace Pos // position of REPLACE keyword InsertOr Pos // position of OR keyword after INSERT InsertOrReplace Pos // position of REPLACE keyword after INSERT OR // InsertOrRollback Pos // position of ROLLBACK keyword after INSERT OR // InsertOrAbort Pos // position of ABORT keyword after INSERT OR // InsertOrFail Pos // position of FAIL keyword after INSERT OR // InsertOrIgnore Pos // position of IGNORE keyword after INSERT OR Into Pos // position of INTO keyword Table *Ident // table name As Pos // position of AS keyword Alias *Ident // optional alias ColumnsLparen Pos // position of column list left paren Columns []*Ident // optional column list ColumnsRparen Pos // position of column list right paren Values Pos // position of VALUES keyword TupleList []*ExprList // multiple tuples }
func (*InsertStatement) Clone ¶
func (s *InsertStatement) Clone() *InsertStatement
Clone returns a deep copy of s.
func (*InsertStatement) String ¶
func (s *InsertStatement) String() string
type IntegerLit ¶
func (*IntegerLit) Clone ¶
func (lit *IntegerLit) Clone() *IntegerLit
Clone returns a deep copy of lit.
func (*IntegerLit) DataType ¶
func (expr *IntegerLit) DataType() ExprDataType
func (*IntegerLit) IsLiteral ¶
func (expr *IntegerLit) IsLiteral() bool
func (*IntegerLit) Pos ¶
func (expr *IntegerLit) Pos() Pos
func (*IntegerLit) String ¶
func (lit *IntegerLit) String() string
String returns the string representation of the expression.
type JoinClause ¶
type JoinClause struct { X Source // lhs source Operator *JoinOperator // join operator Y Source // rhs source Constraint JoinConstraint // join constraint }
func (*JoinClause) OutputColumnNamed ¶
func (c *JoinClause) OutputColumnNamed(name string) (*SourceOutputColumn, error)
func (*JoinClause) OutputColumnQualifierNamed ¶
func (c *JoinClause) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
func (*JoinClause) PossibleOutputColumns ¶
func (c *JoinClause) PossibleOutputColumns() []*SourceOutputColumn
func (*JoinClause) SourceFromAlias ¶
func (c *JoinClause) SourceFromAlias(alias string) Source
func (*JoinClause) String ¶
func (c *JoinClause) String() string
String returns the string representation of the clause.
type JoinConstraint ¶
type JoinConstraint interface { Node // contains filtered or unexported methods }
JoinConstraint represents either an ON or USING join constraint.
func CloneJoinConstraint ¶
func CloneJoinConstraint(cons JoinConstraint) JoinConstraint
CloneJoinConstraint returns a deep copy cons.
type JoinOperator ¶
type JoinOperator struct { Comma Pos // position of comma Left Pos // position of LEFT keyword Right Pos // position of RIGHT keyword Full Pos // position of FULL keyword Outer Pos // position of OUTER keyword Inner Pos // position of INNER keyword // Cross Pos // position of CROSS keyword // TODO(pok) - add cross back when we do it Join Pos // position of JOIN keyword }
func (*JoinOperator) Clone ¶
func (op *JoinOperator) Clone() *JoinOperator
Clone returns a deep copy of op.
func (*JoinOperator) String ¶
func (op *JoinOperator) String() string
String returns the string representation of the operator.
type KeyPartitionsOption ¶
type KeyPartitionsOption struct { KeyPartitions Pos // position of KEYPARTITIONS keyword Expr Expr // expression }
func (*KeyPartitionsOption) String ¶
func (o *KeyPartitionsOption) String() string
type MaxConstraint ¶
func (*MaxConstraint) Clone ¶
func (c *MaxConstraint) Clone() *MaxConstraint
Clone returns a deep copy of c.
func (*MaxConstraint) String ¶
func (c *MaxConstraint) String() string
String returns the string representation of the constraint.
type MinConstraint ¶
func (*MinConstraint) Clone ¶
func (c *MinConstraint) Clone() *MinConstraint
Clone returns a deep copy of c.
func (*MinConstraint) String ¶
func (c *MinConstraint) String() string
String returns the string representation of the constraint.
type Node ¶
type NotNullConstraint ¶
type NotNullConstraint struct { Constraint Pos // position of CONSTRAINT keyword Name *Ident // constraint name Not Pos // position of NOT keyword Null Pos // position of NULL keyword }
func (*NotNullConstraint) Clone ¶
func (c *NotNullConstraint) Clone() *NotNullConstraint
Clone returns a deep copy of c.
func (*NotNullConstraint) String ¶
func (c *NotNullConstraint) String() string
String returns the string representation of the constraint.
type NullLit ¶
type NullLit struct {
ValuePos Pos
}
func (*NullLit) DataType ¶
func (expr *NullLit) DataType() ExprDataType
type OnConstraint ¶
func (*OnConstraint) Clone ¶
func (c *OnConstraint) Clone() *OnConstraint
Clone returns a deep copy of c.
func (*OnConstraint) String ¶
func (c *OnConstraint) String() string
String returns the string representation of the constraint.
type OrderingTerm ¶
type OrderingTerm struct { X Expr // ordering expression Asc Pos // position of ASC keyword Desc Pos // position of DESC keyword Nulls Pos // position of NULLS keyword NullsFirst Pos // position of FIRST keyword NullsLast Pos // position of LAST keyword }
func (*OrderingTerm) Clone ¶
func (t *OrderingTerm) Clone() *OrderingTerm
Clone returns a deep copy of t.
func (*OrderingTerm) String ¶
func (t *OrderingTerm) String() string
String returns the string representation of the term.
type OverClause ¶
type OverClause struct { Over Pos // position of OVER keyword Name *Ident // window name Definition *WindowDefinition // window definition }
func (*OverClause) String ¶
func (c *OverClause) String() string
String returns the string representation of the clause.
type ParameterDefinition ¶
type ParenExpr ¶
type ParenExpr struct { Lparen Pos // position of left paren X Expr // parenthesized expression Rparen Pos // position of right paren }
func (*ParenExpr) DataType ¶
func (expr *ParenExpr) DataType() ExprDataType
type ParenSource ¶
type ParenSource struct { Lparen Pos // position of left paren X Source // nested source Rparen Pos // position of right paren As Pos // position of AS keyword (select source only) Alias *Ident // optional table alias (select source only) }
func (*ParenSource) Clone ¶
func (s *ParenSource) Clone() *ParenSource
Clone returns a deep copy of s.
func (*ParenSource) OutputColumnNamed ¶
func (c *ParenSource) OutputColumnNamed(name string) (*SourceOutputColumn, error)
func (*ParenSource) OutputColumnQualifierNamed ¶
func (c *ParenSource) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
func (*ParenSource) PossibleOutputColumns ¶
func (c *ParenSource) PossibleOutputColumns() []*SourceOutputColumn
func (*ParenSource) SourceFromAlias ¶
func (c *ParenSource) SourceFromAlias(alias string) Source
func (*ParenSource) String ¶
func (s *ParenSource) String() string
String returns the string representation of the source.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a SQL parser.
func (*Parser) ParseStatement ¶
type Pos ¶
type PrimaryKeyConstraint ¶
type PrimaryKeyConstraint struct { Constraint Pos // position of CONSTRAINT keyword Name *Ident // constraint name Primary Pos // position of PRIMARY keyword Key Pos // position of KEY keyword Lparen Pos // position of left paren (table only) Columns []*Ident // indexed columns (table only) Rparen Pos // position of right paren (table only) Autoincrement Pos // position of AUTOINCREMENT keyword (column only) }
func (*PrimaryKeyConstraint) Clone ¶
func (c *PrimaryKeyConstraint) Clone() *PrimaryKeyConstraint
Clone returns a deep copy of c.
func (*PrimaryKeyConstraint) String ¶
func (c *PrimaryKeyConstraint) String() string
String returns the string representation of the constraint.
type QualifiedRef ¶
type QualifiedRef struct { Table *Ident // table name Dot Pos // position of dot Star Pos // position of * (result column only) Column *Ident // column name ColumnIndex int // Set by the planner; not at parse-time RefDataType ExprDataType }
func (*QualifiedRef) Clone ¶
func (r *QualifiedRef) Clone() *QualifiedRef
Clone returns a deep copy of r.
func (*QualifiedRef) DataType ¶
func (expr *QualifiedRef) DataType() ExprDataType
func (*QualifiedRef) IsLiteral ¶
func (expr *QualifiedRef) IsLiteral() bool
func (*QualifiedRef) Pos ¶
func (expr *QualifiedRef) Pos() Pos
func (*QualifiedRef) String ¶
func (r *QualifiedRef) String() string
String returns the string representation of the expression.
type QualifiedTableName ¶
type QualifiedTableName struct { Name *Ident // table name As Pos // position of AS keyword Alias *Ident // optional table alias Indexed Pos // position of INDEXED keyword IndexedBy Pos // position of BY keyword after INDEXED Not Pos // position of NOT keyword before INDEXED NotIndexed Pos // position of NOT keyword before INDEXED Index *Ident // name of index OutputColumns []*SourceOutputColumn // output columns - populated during analysis }
func (*QualifiedTableName) Clone ¶
func (n *QualifiedTableName) Clone() *QualifiedTableName
Clone returns a deep copy of n.
func (*QualifiedTableName) MatchesTablenameOrAlias ¶
func (n *QualifiedTableName) MatchesTablenameOrAlias(match string) bool
func (*QualifiedTableName) OutputColumnNamed ¶
func (c *QualifiedTableName) OutputColumnNamed(name string) (*SourceOutputColumn, error)
func (*QualifiedTableName) OutputColumnQualifierNamed ¶
func (c *QualifiedTableName) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
func (*QualifiedTableName) PossibleOutputColumns ¶
func (c *QualifiedTableName) PossibleOutputColumns() []*SourceOutputColumn
func (*QualifiedTableName) SourceFromAlias ¶
func (c *QualifiedTableName) SourceFromAlias(alias string) Source
func (*QualifiedTableName) String ¶
func (n *QualifiedTableName) String() string
String returns the string representation of the table name.
func (*QualifiedTableName) TableName ¶
func (n *QualifiedTableName) TableName() string
TableName returns the name used to identify n. Returns the alias, if one is specified. Otherwise returns the name.
type Range ¶
type Range struct { X Expr // lhs expression And Pos // position of AND keyword Y Expr // rhs expression ResultDataType ExprDataType }
func (*Range) DataType ¶
func (expr *Range) DataType() ExprDataType
type ReleaseStatement ¶
type ReleaseStatement struct { Release Pos // position of RELEASE keyword Savepoint Pos // position of SAVEPOINT keyword (optional) Name *Ident // name of savepoint }
func (*ReleaseStatement) Clone ¶
func (s *ReleaseStatement) Clone() *ReleaseStatement
Clone returns a deep copy of s.
func (*ReleaseStatement) String ¶
func (s *ReleaseStatement) String() string
String returns the string representation of the statement.
type ResultColumn ¶
type ResultColumn struct { Star Pos // position of * Expr Expr // column expression (may be "tbl.*") As Pos // position of AS keyword Alias *Ident // alias name }
func (*ResultColumn) Clone ¶
func (c *ResultColumn) Clone() *ResultColumn
Clone returns a deep copy of c.
func (*ResultColumn) IsLiteral ¶
func (expr *ResultColumn) IsLiteral() bool
func (*ResultColumn) Name ¶
func (c *ResultColumn) Name() string
Name returns the column name. Uses the alias, if specified. Otherwise returns a generated name.
func (*ResultColumn) String ¶
func (c *ResultColumn) String() string
String returns the string representation of the column.
type RollbackStatement ¶
type RollbackStatement struct { Rollback Pos // position of ROLLBACK keyword Transaction Pos // position of TRANSACTION keyword (optional) To Pos // position of TO keyword (optional) Savepoint Pos // position of SAVEPOINT keyword (optional) SavepointName *Ident // name of savepoint }
func (*RollbackStatement) Clone ¶
func (s *RollbackStatement) Clone() *RollbackStatement
Clone returns a deep copy of s.
func (*RollbackStatement) String ¶
func (s *RollbackStatement) String() string
String returns the string representation of the statement.
type SavepointStatement ¶
type SavepointStatement struct { Savepoint Pos // position of SAVEPOINT keyword Name *Ident // name of savepoint }
func (*SavepointStatement) Clone ¶
func (s *SavepointStatement) Clone() *SavepointStatement
Clone returns a deep copy of s.
func (*SavepointStatement) String ¶
func (s *SavepointStatement) String() string
String returns the string representation of the statement.
type SelectStatement ¶
type SelectStatement struct { WithClause *WithClause // clause containing CTEs Select Pos // position of SELECT keyword Distinct Pos // position of DISTINCT keyword // All Pos // position of ALL keyword Columns []*ResultColumn // list of result columns in the SELECT clause Top Pos // position of TOP keyword TopN Pos // position of TOPN keyword TopExpr Expr // TOP expr From Pos // position of FROM keyword Source Source // chain of tables & subqueries in FROM clause Where Pos // position of WHERE keyword WhereExpr Expr // condition for WHERE clause Group Pos // position of GROUP keyword GroupBy Pos // position of BY keyword after GROUP GroupByExprs []Expr // group by expression list Having Pos // position of HAVING keyword HavingExpr Expr // HAVING expression Window Pos // position of WINDOW keyword Windows []*Window // window list Union Pos // position of UNION keyword UnionAll Pos // position of ALL keyword after UNION Intersect Pos // position of INTERSECT keyword Except Pos // position of EXCEPT keyword Compound *SelectStatement // compounded SELECT statement Order Pos // position of ORDER keyword OrderBy Pos // position of BY keyword after ORDER OrderingTerms []*OrderingTerm // terms of ORDER BY clause }
func (*SelectStatement) Clone ¶
func (s *SelectStatement) Clone() *SelectStatement
Clone returns a deep copy of s.
func (*SelectStatement) DataType ¶
func (s *SelectStatement) DataType() ExprDataType
func (*SelectStatement) HasWildcard ¶
func (s *SelectStatement) HasWildcard() bool
HasWildcard returns true any result column contains a wildcard (STAR).
func (*SelectStatement) IsLiteral ¶
func (expr *SelectStatement) IsLiteral() bool
func (*SelectStatement) OutputColumnNamed ¶
func (c *SelectStatement) OutputColumnNamed(name string) (*SourceOutputColumn, error)
func (*SelectStatement) OutputColumnQualifierNamed ¶
func (c *SelectStatement) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
func (*SelectStatement) Pos ¶
func (s *SelectStatement) Pos() Pos
func (*SelectStatement) PossibleOutputColumns ¶
func (c *SelectStatement) PossibleOutputColumns() []*SourceOutputColumn
func (*SelectStatement) SourceFromAlias ¶
func (c *SelectStatement) SourceFromAlias(alias string) Source
func (*SelectStatement) String ¶
func (s *SelectStatement) String() string
String returns the string representation of the statement.
type SetLiteralExpr ¶
type SetLiteralExpr struct { Lbracket Pos // position of left bracket Members []Expr // bracketed expression Rbracket Pos // position of right bracket ResultDataType ExprDataType }
func (*SetLiteralExpr) Clone ¶
func (expr *SetLiteralExpr) Clone() *SetLiteralExpr
Clone returns a deep copy of expr.
func (*SetLiteralExpr) DataType ¶
func (expr *SetLiteralExpr) DataType() ExprDataType
func (*SetLiteralExpr) IsLiteral ¶
func (expr *SetLiteralExpr) IsLiteral() bool
func (*SetLiteralExpr) Pos ¶
func (expr *SetLiteralExpr) Pos() Pos
func (*SetLiteralExpr) String ¶
func (expr *SetLiteralExpr) String() string
String returns the string representation of the expression.
type ShowColumnsStatement ¶
type ShowColumnsStatement struct { Show Pos // position of SHOW Columns Pos // position of COLUMNS From Pos // position of FROM TableName *Ident // name of table }
func (*ShowColumnsStatement) String ¶
func (s *ShowColumnsStatement) String() string
String returns the string representation of the statement.
type ShowCreateTableStatement ¶
type ShowCreateTableStatement struct { Show Pos // position of SHOW Create Pos // position of CREATE Table Pos // position of CREATE TableName *Ident // name of table }
func (*ShowCreateTableStatement) String ¶
func (s *ShowCreateTableStatement) String() string
String returns the string representation of the statement.
type ShowTablesStatement ¶
func (*ShowTablesStatement) String ¶
func (s *ShowTablesStatement) String() string
String returns the string representation of the statement.
type Source ¶
type Source interface { Node SourceFromAlias(alias string) Source // get the possible output columns from the source PossibleOutputColumns() []*SourceOutputColumn // find output columns by name OutputColumnNamed(name string) (*SourceOutputColumn, error) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error) // contains filtered or unexported methods }
Source represents a data source for a select statement. A select statement has one source, but they can be one of a table ref, a join, another select statement or any of the above parenthesiszed. For join operators, the Source can form a graph, with the join terms being themselves a Source.
func SourceList ¶
SourceList returns a list of sources starting from a source.
func StatementSource ¶
StatementSource returns the root statement for a statement.
type SourceOutputColumn ¶
type SourceOutputColumn struct { TableName string ColumnName string ColumnIndex int Datatype ExprDataType }
SourceOutputColumn is an identifier that is either a possible output column for a Source or a referenced output column for a Source. These are computed during the analysis phase
type Statement ¶
type Statement interface { Node // contains filtered or unexported methods }
func CloneStatement ¶
CloneStatement returns a deep copy stmt.
type StringLit ¶
type StringLit struct { ValuePos Pos // literal position Value string // literal value (without quotes) }
func (*StringLit) ConvertToTimestamp ¶
func (*StringLit) DataType ¶
func (expr *StringLit) DataType() ExprDataType
type SubtableColumn ¶
type SubtableColumn struct { Name string DataType ExprDataType }
type TableOption ¶
type TableOption interface { Node // contains filtered or unexported methods }
type TableValuedFunction ¶
type TableValuedFunction struct { Name *Ident // table name As Pos // position of AS keyword Alias *Ident // optional table alias Call *Call // call OutputColumns []*SourceOutputColumn // output columns - populated during analysis }
func (*TableValuedFunction) Clone ¶
func (n *TableValuedFunction) Clone() *TableValuedFunction
Clone returns a deep copy of n.
func (*TableValuedFunction) MatchesTablenameOrAlias ¶
func (n *TableValuedFunction) MatchesTablenameOrAlias(match string) bool
func (*TableValuedFunction) OutputColumnNamed ¶
func (c *TableValuedFunction) OutputColumnNamed(name string) (*SourceOutputColumn, error)
func (*TableValuedFunction) OutputColumnQualifierNamed ¶
func (c *TableValuedFunction) OutputColumnQualifierNamed(qualifier string, name string) (*SourceOutputColumn, error)
func (*TableValuedFunction) PossibleOutputColumns ¶
func (c *TableValuedFunction) PossibleOutputColumns() []*SourceOutputColumn
func (*TableValuedFunction) SourceFromAlias ¶
func (c *TableValuedFunction) SourceFromAlias(alias string) Source
func (*TableValuedFunction) String ¶
func (n *TableValuedFunction) String() string
String returns the string representation of the table name.
func (*TableValuedFunction) TableName ¶
func (n *TableValuedFunction) TableName() string
TableName returns the name used to identify n. Returns the alias, if one is specified. Otherwise returns the name.
type TimeQuantumConstraint ¶
type TimeQuantumConstraint struct { TimeQuantum Pos // position of TIMEQUANTUM keyword Expr Expr // expression Ttl Pos TtlExpr Expr }
func (*TimeQuantumConstraint) Clone ¶
func (c *TimeQuantumConstraint) Clone() *TimeQuantumConstraint
Clone returns a deep copy of c.
func (*TimeQuantumConstraint) String ¶
func (c *TimeQuantumConstraint) String() string
String returns the string representation of the constraint.
type TimeUnitConstraint ¶
type TimeUnitConstraint struct { TimeUnit Pos // position of TIMEUNIT keyword Expr Expr // expression Epoch Pos // position of TIMEUNIT keyword EpochExpr Expr // expression }
func (*TimeUnitConstraint) Clone ¶
func (c *TimeUnitConstraint) Clone() *TimeUnitConstraint
Clone returns a deep copy of c.
func (*TimeUnitConstraint) String ¶
func (c *TimeUnitConstraint) String() string
String returns the string representation of the constraint.
type Token ¶
type Token int
Token is the set of lexical tokens of the Go programming language.
const ( // Special tokens ILLEGAL Token = iota EOF SPACE UNTERMSTRING IDENT // IDENT VARIABLE // VARIABLE QIDENT // "IDENT" STRING // 'string' BLOB // X'data' FLOAT // 123.45 INTEGER // 123 NULL // NULL TRUE // true FALSE // false SEMI // ; LP // ( RP // ) LB // [ RB // ] LBR // { RBR // } COMMA // , NE // != EQ // = LE // <= LT // < GT // > GE // >= BITAND // & BITOR // | BITNOT // ! LSHIFT // << RSHIFT // >> PLUS // + MINUS // - STAR // * SLASH // / REM // % CONCAT // || DOT // . ABORT ACTION ADD AFTER AGG_COLUMN AGG_FUNCTION ALL ALTER ANALYZE AND AS ASC ASTERISK ATTACH AUTOINCREMENT BEFORE BEGIN BETWEEN BY BULK CACHETYPE CASCADE CASE CAST CHECK COLUMN COLUMNS COLUMNKW COMMIT COMMENT CONFLICT CONSTRAINT CREATE CROSS CTIME_KW CURRENT CURRENT_DATE CURRENT_TIMESTAMP DATABASE DEFAULT DEFERRABLE DEFERRED DELETE DESC DETACH DISTINCT DO DROP EACH ELSE END EPOCH ESCAPE EXCEPT EXCLUDE EXCLUSIVE EXISTS EXPLAIN FAIL FILTER FIRST FOLLOWING FOR FOREIGN FROM FULL FUNCTION GLOB GROUP GROUPS HAVING IF IF_NULL_ROW IGNORE IMMEDIATE IN INDEX INDEXED INITIALLY INNER INSERT INSTEAD INTERSECT INTO IS ISNOT JOIN KEY KEYPARTITIONS LAST LEFT LIKE LRU MAP MATCH MAX MIN NO NOT NOTBETWEEN NOTEXISTS NOTGLOB NOTHING NOTIN NOTLIKE NOTMATCH NOTREGEXP NULLS OF ON OR ORDER OTHERS OUTER OVER PARTITION PLAN PRAGMA PRECEDING PRIMARY QUERY RANGE RANKED RECURSIVE REFERENCES REGEXP REGISTER REINDEX RELEASE RENAME REPLACE RESTRICT RETURNS RETURN RIGHT ROLLBACK ROW ROWS SAVEPOINT SELECT SELECT_COLUMN SET SIZE SHOW SPAN TABLE TABLES TEMP THEN TIES TIMEUNIT TIMEQUANTUM TO TOP TOPN TRANSACTION TRANSFORM TRIGGER TRUTH TTL UNBOUNDED UNION UNIQUE UPDATE USING VACUUM VALUES VECTOR VIEW VIRTUAL WHEN WHERE WINDOW WITH WITHOUT ANY // ??? )
TODO (pok) remove unnecessary tokens The list of tokens.
func (Token) IsBinaryOp ¶
func (Token) IsOperator ¶
func (Token) Precedence ¶
type TupleLiteralExpr ¶
type TupleLiteralExpr struct { Lbrace Pos // position of left brace Members []Expr // bracketed expression Rbrace Pos // position of right brace ResultDataType ExprDataType }
func (*TupleLiteralExpr) Clone ¶
func (expr *TupleLiteralExpr) Clone() *TupleLiteralExpr
Clone returns a deep copy of expr.
func (*TupleLiteralExpr) DataType ¶
func (expr *TupleLiteralExpr) DataType() ExprDataType
func (*TupleLiteralExpr) IsLiteral ¶
func (expr *TupleLiteralExpr) IsLiteral() bool
func (*TupleLiteralExpr) Pos ¶
func (expr *TupleLiteralExpr) Pos() Pos
func (*TupleLiteralExpr) String ¶
func (expr *TupleLiteralExpr) String() string
String returns the string representation of the expression.
type Type ¶
type Type struct { Name *Ident // type name Lparen Pos // position of left paren (optional) Precision *IntegerLit // precision (optional) Scale *IntegerLit // scale (optional) Rparen Pos // position of right paren (optional) }
type UnaryExpr ¶
type UnaryExpr struct { OpPos Pos // operation position Op Token // operation X Expr // target expression ResultDataType ExprDataType }
func (*UnaryExpr) DataType ¶
func (expr *UnaryExpr) DataType() ExprDataType
type UniqueConstraint ¶
type UniqueConstraint struct { Constraint Pos // position of CONSTRAINT keyword Name *Ident // constraint name Unique Pos // position of UNIQUE keyword Lparen Pos // position of left paren (table only) Columns []*Ident // indexed columns (table only) Rparen Pos // position of right paren (table only) }
func (*UniqueConstraint) Clone ¶
func (c *UniqueConstraint) Clone() *UniqueConstraint
Clone returns a deep copy of c.
func (*UniqueConstraint) String ¶
func (c *UniqueConstraint) String() string
String returns the string representation of the constraint.
type UpdateStatement ¶
type UpdateStatement struct { WithClause *WithClause // clause containing CTEs Update Pos // position of UPDATE keyword UpdateOr Pos // position of OR keyword after UPDATE UpdateOrReplace Pos // position of REPLACE keyword after UPDATE OR UpdateOrRollback Pos // position of ROLLBACK keyword after UPDATE OR UpdateOrAbort Pos // position of ABORT keyword after UPDATE OR UpdateOrFail Pos // position of FAIL keyword after UPDATE OR UpdateOrIgnore Pos // position of IGNORE keyword after UPDATE OR Table *QualifiedTableName // table name Set Pos // position of SET keyword Assignments []*Assignment // list of column assignments Where Pos // position of WHERE keyword WhereExpr Expr // conditional expression }
func (*UpdateStatement) Clone ¶
func (s *UpdateStatement) Clone() *UpdateStatement
Clone returns a deep copy of s.
func (*UpdateStatement) String ¶
func (s *UpdateStatement) String() string
String returns the string representation of the clause.
type UpsertClause ¶
type UpsertClause struct { On Pos // position of ON keyword OnConflict Pos // position of CONFLICT keyword after ON Lparen Pos // position of column list left paren Columns []*IndexedColumn // optional indexed column list Rparen Pos // position of column list right paren Where Pos // position of WHERE keyword WhereExpr Expr // optional conditional expression Do Pos // position of DO keyword DoNothing Pos // position of NOTHING keyword after DO DoUpdate Pos // position of UPDATE keyword after DO DoUpdateSet Pos // position of SET keyword after DO UPDATE Assignments []*Assignment // list of column assignments UpdateWhere Pos // position of WHERE keyword for DO UPDATE SET UpdateWhereExpr Expr // optional conditional expression for DO UPDATE SET }
func (*UpsertClause) Clone ¶
func (c *UpsertClause) Clone() *UpsertClause
Clone returns a deep copy of c.
func (*UpsertClause) String ¶
func (c *UpsertClause) String() string
String returns the string representation of the clause.
type UsingConstraint ¶
type UsingConstraint struct { Using Pos // position of USING keyword Lparen Pos // position of left paren Columns []*Ident // column list Rparen Pos // position of right paren }
func (*UsingConstraint) Clone ¶
func (c *UsingConstraint) Clone() *UsingConstraint
Clone returns a deep copy of c.
func (*UsingConstraint) String ¶
func (c *UsingConstraint) String() string
String returns the string representation of the constraint.
type Variable ¶
type Variable struct { NamePos Pos // variable position Name string // variable name VariableIndex int VarDataType ExprDataType }
func (*Variable) DataType ¶
func (expr *Variable) DataType() ExprDataType
type VisitEndFunc ¶
VisitEndFunc represents a function type that implements Visitor. Only executes on node exit.
type VisitFunc ¶
VisitFunc represents a function type that implements Visitor. Only executes on node entry.
type Visitor ¶
type Visitor interface { Visit(node Node) (w Visitor, n Node, err error) VisitEnd(node Node) (Node, error) }
A Visitor's Visit method is invoked for each node encountered by Walk. If the result visitor w is not nil, Walk visits each of the children of node with the visitor w, followed by a call of w.Visit(nil).
type Window ¶
type Window struct { Name *Ident // name of window As Pos // position of AS keyword Definition *WindowDefinition // window definition }
type WindowDefinition ¶
type WindowDefinition struct { Lparen Pos // position of left paren Base *Ident // base window name Partition Pos // position of PARTITION keyword PartitionBy Pos // position of BY keyword (after PARTITION) Partitions []Expr // partition expressions Order Pos // position of ORDER keyword OrderBy Pos // position of BY keyword (after ORDER) OrderingTerms []*OrderingTerm // ordering terms Frame *FrameSpec // frame Rparen Pos // position of right paren }
func (*WindowDefinition) Clone ¶
func (d *WindowDefinition) Clone() *WindowDefinition
Clone returns a deep copy of d.
func (*WindowDefinition) String ¶
func (d *WindowDefinition) String() string
String returns the string representation of the window definition.
type WithClause ¶
type WithClause struct { With Pos // position of WITH keyword Recursive Pos // position of RECURSIVE keyword CTEs []*CTE // common table expressions }
func (*WithClause) String ¶
func (c *WithClause) String() string
String returns the string representation of the clause.