Documentation
¶
Overview ¶
Package sqlast declares types that used to represent abstract syntax tree of sql. Basically, these definitions are from https://github.com/andygrove/sqlparser-rs and https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_5_lexical_elements. However, in some cases, the syntax is extended to support RDBMS specific syntax such as PGAlterTableAction.
Index ¶
- func Inspect(node Node, f func(node Node) bool)
- func NewSize(s uint) *uint
- func Walk(v Visitor, node Node)
- type AddColumnTableAction
- type AddConstraintTableAction
- type AliasSelectItem
- type AlterColumnAction
- type AlterColumnTableAction
- type AlterTableAction
- type AlterTableStmt
- type Array
- type Assignment
- type AutoIncrement
- type Between
- type BigInt
- type Binary
- type BinaryExpr
- type Blob
- type Boolean
- type BooleanValue
- type Bytea
- type CTE
- type CaseExpr
- type Cast
- type CharType
- type CheckColumnSpec
- type CheckTableConstraint
- type Clob
- type ColumnConstraint
- type ColumnConstraintSpec
- type ColumnDef
- type Comment
- type CommentGroup
- type CommentMap
- type CompoundIdent
- type ConstructorSource
- type CopyStmt
- type CreateIndexStmt
- type CreateTableStmt
- type CreateViewStmt
- type CreateVirtualTableStmt
- type CrossJoin
- type CurrentRow
- type Custom
- type Date
- type DateTimeValue
- type DateValue
- type Decimal
- type DeleteStmt
- type Derived
- type Double
- type DoubleValue
- type DropConstraintTableAction
- type DropDefaultColumnAction
- type DropIndexStmt
- type DropTableStmt
- type ExceptOperator
- type Exists
- type ExplainStmt
- type File
- type FileFormat
- type Float
- type Following
- type Function
- type Ident
- type InList
- type InSubQuery
- type InsertSource
- type InsertStmt
- type Int
- type IntersectOperator
- type IsNotNull
- type IsNull
- type JoinCondition
- type JoinElement
- type JoinSpec
- type JoinType
- type JoinTypeCondition
- type LimitExpr
- type LongValue
- type MyCharset
- type MyDataTypeDecoration
- type MyEngine
- type NamedColumnsJoin
- type NationalStringLiteral
- type NaturalJoin
- type Nested
- type Node
- type NotNullColumnSpec
- type NullValue
- type ObjectName
- type Operator
- type OperatorType
- type OrderByExpr
- type PGAlterDataTypeColumnAction
- type PGDropNotNullColumnAction
- type PGSetNotNullColumnAction
- type PartitionedJoinTable
- type Preceding
- type QualifiedJoin
- type QualifiedWildcard
- type QualifiedWildcardSelectItem
- type QueryExpr
- type QueryStmt
- type Real
- type ReferenceKeyExpr
- type ReferencesColumnSpec
- type ReferentialTableConstraint
- type Regclass
- type RemoveColumnTableAction
- type RowValueExpr
- type SQLSelect
- type SQLSelectItem
- type SQLSetExpr
- type SQLSetOperator
- type SQLWindowFrameBound
- type SelectExpr
- type SetDefaultColumnAction
- type SetOperationExpr
- type SingleQuotedString
- type SmallInt
- type Stmt
- type SubQuery
- type SubQuerySource
- type Table
- type TableConstraint
- type TableConstraintSpec
- type TableElement
- type TableFactor
- type TableJoinElement
- type TableOption
- type TableReference
- type Text
- type Time
- type TimeValue
- type Timestamp
- type TimestampValue
- type Type
- type UUID
- type UnaryExpr
- type UnboundedFollowing
- type UnboundedPreceding
- type UnionOperator
- type UniqueColumnSpec
- type UniqueTableConstraint
- type UnnamedSelectItem
- type UpdateStmt
- type Value
- type Varbinary
- type VarcharType
- type Visitor
- type Wildcard
- type WildcardSelectItem
- type WindowFrame
- type WindowFrameUnit
- type WindowFrameUnitType
- type WindowSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddColumnTableAction ¶
type AddColumnTableAction struct {
Add sqltoken.Pos
Column *ColumnDef
// contains filtered or unexported fields
}
func (*AddColumnTableAction) End ¶
func (a *AddColumnTableAction) End() sqltoken.Pos
func (*AddColumnTableAction) Pos ¶
func (a *AddColumnTableAction) Pos() sqltoken.Pos
func (*AddColumnTableAction) ToSQLString ¶
func (a *AddColumnTableAction) ToSQLString() string
type AddConstraintTableAction ¶
type AddConstraintTableAction struct {
Add sqltoken.Pos
Constraint *TableConstraint
// contains filtered or unexported fields
}
func (*AddConstraintTableAction) End ¶
func (a *AddConstraintTableAction) End() sqltoken.Pos
func (*AddConstraintTableAction) Pos ¶
func (a *AddConstraintTableAction) Pos() sqltoken.Pos
func (*AddConstraintTableAction) ToSQLString ¶
func (a *AddConstraintTableAction) ToSQLString() string
type AliasSelectItem ¶
func (*AliasSelectItem) End ¶
func (a *AliasSelectItem) End() sqltoken.Pos
func (*AliasSelectItem) Pos ¶
func (a *AliasSelectItem) Pos() sqltoken.Pos
func (*AliasSelectItem) ToSQLString ¶
func (a *AliasSelectItem) ToSQLString() string
type AlterColumnAction ¶
type AlterColumnAction interface {
Node
// contains filtered or unexported methods
}
type AlterColumnTableAction ¶
type AlterColumnTableAction struct {
ColumnName *Ident
Alter sqltoken.Pos
Action AlterColumnAction
// contains filtered or unexported fields
}
func (*AlterColumnTableAction) End ¶
func (a *AlterColumnTableAction) End() sqltoken.Pos
func (*AlterColumnTableAction) Pos ¶
func (a *AlterColumnTableAction) Pos() sqltoken.Pos
func (*AlterColumnTableAction) ToSQLString ¶
func (a *AlterColumnTableAction) ToSQLString() string
type AlterTableAction ¶
type AlterTableAction interface {
Node
// contains filtered or unexported methods
}
type AlterTableStmt ¶
type AlterTableStmt struct {
Alter sqltoken.Pos
TableName *ObjectName
Action AlterTableAction
// contains filtered or unexported fields
}
func (*AlterTableStmt) End ¶
func (a *AlterTableStmt) End() sqltoken.Pos
func (*AlterTableStmt) Pos ¶
func (a *AlterTableStmt) Pos() sqltoken.Pos
func (*AlterTableStmt) ToSQLString ¶
func (a *AlterTableStmt) ToSQLString() string
type Array ¶
func (*Array) ToSQLString ¶
type Assignment ¶
func (*Assignment) End ¶
func (a *Assignment) End() sqltoken.Pos
func (*Assignment) Pos ¶
func (a *Assignment) Pos() sqltoken.Pos
func (*Assignment) ToSQLString ¶
func (a *Assignment) ToSQLString() string
type AutoIncrement ¶
type AutoIncrement struct {
Auto sqltoken.Pos
Increment sqltoken.Pos
// contains filtered or unexported fields
}
func (*AutoIncrement) End ¶
func (a *AutoIncrement) End() sqltoken.Pos
func (*AutoIncrement) Pos ¶
func (a *AutoIncrement) Pos() sqltoken.Pos
func (*AutoIncrement) ToSQLString ¶
func (a *AutoIncrement) ToSQLString() string
type BigInt ¶
func (*BigInt) ToSQLString ¶
type Binary ¶
func (*Binary) ToSQLString ¶
type BinaryExpr ¶
`Left Op Right`
func (*BinaryExpr) End ¶
func (s *BinaryExpr) End() sqltoken.Pos
func (*BinaryExpr) Pos ¶
func (s *BinaryExpr) Pos() sqltoken.Pos
func (*BinaryExpr) ToSQLString ¶
func (s *BinaryExpr) ToSQLString() string
type Blob ¶
func (*Blob) ToSQLString ¶
type Boolean ¶
func (*Boolean) ToSQLString ¶
type BooleanValue ¶
func NewBooleanValue ¶
func NewBooleanValue(b bool) *BooleanValue
func (*BooleanValue) End ¶
func (b *BooleanValue) End() sqltoken.Pos
func (*BooleanValue) Pos ¶
func (b *BooleanValue) Pos() sqltoken.Pos
func (*BooleanValue) ToSQLString ¶
func (b *BooleanValue) ToSQLString() string
func (*BooleanValue) Value ¶
func (b *BooleanValue) Value() interface{}
type Bytea ¶
func (*Bytea) ToSQLString ¶
type CaseExpr ¶
type CaseExpr struct {
Case sqltoken.Pos // first position of CASE keyword
CaseEnd sqltoken.Pos // Last position of END keyword
Operand Node
Conditions []Node
Results []Node
ElseResult Node
}
CASE [Operand] WHEN Conditions... THEN Results... [ELSE ElseResult] END
func (*CaseExpr) ToSQLString ¶
type Cast ¶
type Cast struct {
Expr Node
DataType Type
Cast sqltoken.Pos // first position of CAST token
RParen sqltoken.Pos
}
`CAST(Expr AS DataType)`
func (*Cast) ToSQLString ¶
type CharType ¶
func (*CharType) ToSQLString ¶
type CheckColumnSpec ¶
func (*CheckColumnSpec) End ¶
func (c *CheckColumnSpec) End() sqltoken.Pos
func (*CheckColumnSpec) Pos ¶
func (c *CheckColumnSpec) Pos() sqltoken.Pos
func (*CheckColumnSpec) ToSQLString ¶
func (c *CheckColumnSpec) ToSQLString() string
type CheckTableConstraint ¶
type CheckTableConstraint struct {
Check sqltoken.Pos
RParen sqltoken.Pos
Expr Node
// contains filtered or unexported fields
}
func (*CheckTableConstraint) End ¶
func (c *CheckTableConstraint) End() sqltoken.Pos
func (*CheckTableConstraint) Pos ¶
func (c *CheckTableConstraint) Pos() sqltoken.Pos
func (*CheckTableConstraint) ToSQLString ¶
func (c *CheckTableConstraint) ToSQLString() string
type Clob ¶
func (*Clob) ToSQLString ¶
type ColumnConstraint ¶
type ColumnConstraint struct {
Name *Ident
Constraint sqltoken.Pos
Spec ColumnConstraintSpec
}
func (*ColumnConstraint) End ¶
func (c *ColumnConstraint) End() sqltoken.Pos
func (*ColumnConstraint) Pos ¶
func (c *ColumnConstraint) Pos() sqltoken.Pos
func (*ColumnConstraint) ToSQLString ¶
func (c *ColumnConstraint) ToSQLString() string
type ColumnConstraintSpec ¶
type ColumnConstraintSpec interface {
Node
}
https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#column-constraint
type ColumnDef ¶
type ColumnDef struct {
Name *Ident
DataType Type
Default Node
MyDataTypeDecoration []MyDataTypeDecoration // DataType Decoration for MySQL eg. AUTO_INCREMENT currently, only supports AUTO_INCREMENT
Constraints []*ColumnConstraint
// contains filtered or unexported fields
}
func (*ColumnDef) ToSQLString ¶
type Comment ¶
func (*Comment) ToSQLString ¶
type CommentGroup ¶
type CommentGroup struct {
List []*Comment
}
func (*CommentGroup) End ¶
func (c *CommentGroup) End() sqltoken.Pos
func (*CommentGroup) Pos ¶
func (c *CommentGroup) Pos() sqltoken.Pos
func (*CommentGroup) ToSQLString ¶
func (c *CommentGroup) ToSQLString() string
type CommentMap ¶
type CommentMap map[Node][]*CommentGroup
func NewCommentMap ¶
func NewCommentMap(file *File) CommentMap
type CompoundIdent ¶
type CompoundIdent struct {
Idents []*Ident
}
table.column / schema.table.column
func (*CompoundIdent) End ¶
func (s *CompoundIdent) End() sqltoken.Pos
func (*CompoundIdent) Pos ¶
func (s *CompoundIdent) Pos() sqltoken.Pos
func (*CompoundIdent) ToSQLString ¶
func (s *CompoundIdent) ToSQLString() string
type ConstructorSource ¶
type ConstructorSource struct {
Values sqltoken.Pos
Rows []*RowValueExpr
// contains filtered or unexported fields
}
func (*ConstructorSource) End ¶
func (c *ConstructorSource) End() sqltoken.Pos
func (*ConstructorSource) Pos ¶
func (c *ConstructorSource) Pos() sqltoken.Pos
func (*ConstructorSource) ToSQLString ¶
func (c *ConstructorSource) ToSQLString() string
type CopyStmt ¶
type CopyStmt struct {
Copy sqltoken.Pos
TableName *ObjectName
Columns []*Ident
Values []*string
// contains filtered or unexported fields
}
TODO Remove CopyStmt
func (*CopyStmt) ToSQLString ¶
type CreateIndexStmt ¶
type CreateIndexStmt struct {
Create sqltoken.Pos
TableName *ObjectName
IsUnique bool
IndexName *Ident
MethodName *Ident
ColumnNames []*Ident
RParen sqltoken.Pos
Selection Node
// contains filtered or unexported fields
}
func (*CreateIndexStmt) End ¶
func (c *CreateIndexStmt) End() sqltoken.Pos
func (*CreateIndexStmt) Pos ¶
func (c *CreateIndexStmt) Pos() sqltoken.Pos
func (*CreateIndexStmt) ToSQLString ¶
func (c *CreateIndexStmt) ToSQLString() string
type CreateTableStmt ¶
type CreateTableStmt struct {
Create sqltoken.Pos
Name *ObjectName
Elements []TableElement
Location *string
NotExists bool
Options []TableOption
// contains filtered or unexported fields
}
func (*CreateTableStmt) End ¶
func (c *CreateTableStmt) End() sqltoken.Pos
func (*CreateTableStmt) Pos ¶
func (c *CreateTableStmt) Pos() sqltoken.Pos
func (*CreateTableStmt) ToSQLString ¶
func (c *CreateTableStmt) ToSQLString() string
type CreateViewStmt ¶
type CreateViewStmt struct {
Create sqltoken.Pos
Name *ObjectName
Query *QueryStmt
Materialized bool
// contains filtered or unexported fields
}
func (*CreateViewStmt) End ¶
func (c *CreateViewStmt) End() sqltoken.Pos
func (*CreateViewStmt) Pos ¶
func (c *CreateViewStmt) Pos() sqltoken.Pos
func (*CreateViewStmt) ToSQLString ¶
func (c *CreateViewStmt) ToSQLString() string
type CreateVirtualTableStmt ¶ added in v1.0.4
type CreateVirtualTableStmt struct {
Create sqltoken.Pos
NotExists bool
Name *ObjectName
Using *Ident
Arguments []string
// contains filtered or unexported fields
}
func (*CreateVirtualTableStmt) End ¶ added in v1.0.4
func (c *CreateVirtualTableStmt) End() sqltoken.Pos
func (*CreateVirtualTableStmt) Pos ¶ added in v1.0.4
func (c *CreateVirtualTableStmt) Pos() sqltoken.Pos
func (*CreateVirtualTableStmt) ToSQLString ¶ added in v1.0.4
func (c *CreateVirtualTableStmt) ToSQLString() string
type CrossJoin ¶
type CrossJoin struct {
Reference TableReference
Factor TableFactor
// contains filtered or unexported fields
}
func (*CrossJoin) ToSQLString ¶
type CurrentRow ¶
type CurrentRow struct {
Current sqltoken.Pos
Row sqltoken.Pos
// contains filtered or unexported fields
}
func (*CurrentRow) End ¶
func (c *CurrentRow) End() sqltoken.Pos
func (*CurrentRow) Pos ¶
func (c *CurrentRow) Pos() sqltoken.Pos
func (*CurrentRow) ToSQLString ¶
func (*CurrentRow) ToSQLString() string
type Date ¶
func (*Date) ToSQLString ¶
type DateTimeValue ¶
func NewDateTimeValue ¶
func NewDateTimeValue(t time.Time) *DateTimeValue
func (*DateTimeValue) End ¶
func (d *DateTimeValue) End() sqltoken.Pos
func (*DateTimeValue) Pos ¶
func (d *DateTimeValue) Pos() sqltoken.Pos
func (*DateTimeValue) ToSQLString ¶
func (d *DateTimeValue) ToSQLString() string
func (*DateTimeValue) Value ¶
func (d *DateTimeValue) Value() interface{}
type DateValue ¶
func (*DateValue) ToSQLString ¶
type Decimal ¶
type Decimal struct {
Precision *uint
Scale *uint
Numeric, RParen sqltoken.Pos
IsUnsigned bool
Unsigned sqltoken.Pos
}
func (*Decimal) ToSQLString ¶
type DeleteStmt ¶
type DeleteStmt struct {
Delete sqltoken.Pos
TableName *ObjectName
Selection Node
// contains filtered or unexported fields
}
func (*DeleteStmt) End ¶
func (d *DeleteStmt) End() sqltoken.Pos
func (*DeleteStmt) Pos ¶
func (d *DeleteStmt) Pos() sqltoken.Pos
func (*DeleteStmt) ToSQLString ¶
func (d *DeleteStmt) ToSQLString() string
type Derived ¶
type Derived struct {
Lateral bool
LateralPos sqltoken.Pos // last position of LATERAL keyword if Lateral is true
LParen sqltoken.Pos
RParen sqltoken.Pos
SubQuery *QueryStmt
Alias *Ident
// contains filtered or unexported fields
}
func (*Derived) ToSQLString ¶
type Double ¶
func (*Double) ToSQLString ¶
type DoubleValue ¶
func NewDoubleValue ¶
func NewDoubleValue(f float64) *DoubleValue
func (*DoubleValue) End ¶
func (d *DoubleValue) End() sqltoken.Pos
func (*DoubleValue) Pos ¶
func (d *DoubleValue) Pos() sqltoken.Pos
func (*DoubleValue) ToSQLString ¶
func (d *DoubleValue) ToSQLString() string
func (*DoubleValue) Value ¶
func (d *DoubleValue) Value() interface{}
type DropConstraintTableAction ¶
type DropConstraintTableAction struct {
Name *Ident
Drop sqltoken.Pos
Cascade bool
CascadePos sqltoken.Pos
// contains filtered or unexported fields
}
func (*DropConstraintTableAction) End ¶
func (d *DropConstraintTableAction) End() sqltoken.Pos
func (*DropConstraintTableAction) Pos ¶
func (d *DropConstraintTableAction) Pos() sqltoken.Pos
func (*DropConstraintTableAction) ToSQLString ¶
func (d *DropConstraintTableAction) ToSQLString() string
type DropDefaultColumnAction ¶
type DropDefaultColumnAction struct {
Drop, Default sqltoken.Pos
// contains filtered or unexported fields
}
func (*DropDefaultColumnAction) End ¶
func (d *DropDefaultColumnAction) End() sqltoken.Pos
func (*DropDefaultColumnAction) Pos ¶
func (d *DropDefaultColumnAction) Pos() sqltoken.Pos
func (*DropDefaultColumnAction) ToSQLString ¶
func (*DropDefaultColumnAction) ToSQLString() string
type DropIndexStmt ¶
type DropIndexStmt struct {
Drop sqltoken.Pos
IndexNames []*Ident
// contains filtered or unexported fields
}
func (*DropIndexStmt) End ¶
func (d *DropIndexStmt) End() sqltoken.Pos
func (*DropIndexStmt) Pos ¶
func (d *DropIndexStmt) Pos() sqltoken.Pos
func (*DropIndexStmt) ToSQLString ¶
func (d *DropIndexStmt) ToSQLString() string
type DropTableStmt ¶
type DropTableStmt struct {
TableNames []*ObjectName
Cascade bool
CascadePos sqltoken.Pos
IfExists bool
Drop sqltoken.Pos
// contains filtered or unexported fields
}
func (*DropTableStmt) End ¶
func (d *DropTableStmt) End() sqltoken.Pos
func (*DropTableStmt) Pos ¶
func (d *DropTableStmt) Pos() sqltoken.Pos
func (*DropTableStmt) ToSQLString ¶
func (d *DropTableStmt) ToSQLString() string
type ExceptOperator ¶
func (*ExceptOperator) End ¶
func (e *ExceptOperator) End() sqltoken.Pos
func (*ExceptOperator) Pos ¶
func (e *ExceptOperator) Pos() sqltoken.Pos
func (*ExceptOperator) ToSQLString ¶
func (*ExceptOperator) ToSQLString() string
type Exists ¶
type Exists struct {
Negated bool
Query *QueryStmt
Not sqltoken.Pos // first position of NOT keyword when Negated is true
Exists sqltoken.Pos // first position of EXISTS keyword
RParen sqltoken.Pos
}
[ NOT ] EXISTS (QueryStmt)
func (*Exists) ToSQLString ¶
type ExplainStmt ¶
type ExplainStmt struct {
Stmt Stmt
Explain sqltoken.Pos
// contains filtered or unexported fields
}
func (*ExplainStmt) End ¶
func (e *ExplainStmt) End() sqltoken.Pos
func (*ExplainStmt) Pos ¶
func (e *ExplainStmt) Pos() sqltoken.Pos
func (*ExplainStmt) ToSQLString ¶
func (e *ExplainStmt) ToSQLString() string
type FileFormat ¶
type FileFormat int
TODO remove
const ( TEXTFILE FileFormat = iota SEQUENCEFILE ORC PARQUET AVRO RCFILE JSONFILE )
func (FileFormat) FromStr ¶
func (FileFormat) FromStr(str string) FileFormat
func (*FileFormat) ToSQLString ¶
func (f *FileFormat) ToSQLString() string
type Float ¶
type Float struct {
Size *uint
From, To, RParen sqltoken.Pos
IsUnsigned bool
Unsigned sqltoken.Pos
}
func (*Float) ToSQLString ¶
type Following ¶
type Following struct {
From sqltoken.Pos // first char position of Bound
Following sqltoken.Pos // last char position of FOLLOWING
Bound *uint64
// contains filtered or unexported fields
}
`Bound FOLLOWING`
func (*Following) ToSQLString ¶
type Function ¶
type Function struct {
Name *ObjectName // Function Name
Args []Node
ArgsRParen sqltoken.Pos // function args RParen position
Over *WindowSpec
OverRparen sqltoken.Pos // Over RParen position (if Over is not nil)
}
Name(Args...) [OVER (Over)]
func (*Function) ToSQLString ¶
type Ident ¶
Identifier
func (*Ident) ToSQLString ¶
func (*Ident) WriteStringTo ¶
func (s *Ident) WriteStringTo(w io.StringWriter) (int64, error)
type InSubQuery ¶
`Expr [ NOT ] IN SubQuery`
func (*InSubQuery) End ¶
func (s *InSubQuery) End() sqltoken.Pos
func (*InSubQuery) Pos ¶
func (s *InSubQuery) Pos() sqltoken.Pos
func (*InSubQuery) ToSQLString ¶
func (s *InSubQuery) ToSQLString() string
type InsertSource ¶
type InsertSource interface {
Node
// contains filtered or unexported methods
}
type InsertStmt ¶
type InsertStmt struct {
Insert sqltoken.Pos // first position of INSERT keyword
TableName *ObjectName
Columns []*Ident
Source InsertSource // Insert Source [SubQuery or Constructor]
UpdateAssignments []*Assignment // MySQL only (ON DUPLICATED KEYS)
// contains filtered or unexported fields
}
Insert Statement
func (*InsertStmt) End ¶
func (i *InsertStmt) End() sqltoken.Pos
func (*InsertStmt) Pos ¶
func (i *InsertStmt) Pos() sqltoken.Pos
func (*InsertStmt) ToSQLString ¶
func (i *InsertStmt) ToSQLString() string
type Int ¶
func (*Int) ToSQLString ¶
type IntersectOperator ¶
func (*IntersectOperator) End ¶
func (i *IntersectOperator) End() sqltoken.Pos
func (*IntersectOperator) Pos ¶
func (i *IntersectOperator) Pos() sqltoken.Pos
func (IntersectOperator) ToSQLString ¶
func (IntersectOperator) ToSQLString() string
type JoinCondition ¶
type JoinCondition struct {
SearchCondition Node
On sqltoken.Pos
// contains filtered or unexported fields
}
func (*JoinCondition) End ¶
func (j *JoinCondition) End() sqltoken.Pos
func (*JoinCondition) Pos ¶
func (j *JoinCondition) Pos() sqltoken.Pos
func (*JoinCondition) ToSQLString ¶
func (j *JoinCondition) ToSQLString() string
type JoinElement ¶
type JoinElement interface {
Node
// contains filtered or unexported methods
}
type JoinType ¶
type JoinType struct {
Condition JoinTypeCondition
From, To sqltoken.Pos
}
func (*JoinType) ToSQLString ¶
type JoinTypeCondition ¶
type JoinTypeCondition int
const ( INNER JoinTypeCondition = iota LEFT RIGHT FULL LEFTOUTER RIGHTOUTER FULLOUTER IMPLICIT )
type LimitExpr ¶
type LimitExpr struct {
All bool
AllPos sqltoken.Pos // ALL keyword position if All is true
Limit sqltoken.Pos // Limit keyword position
LimitValue *LongValue
OffsetValue *LongValue
}
LIMIT [ALL | LimitValue ] [ OFFSET OffsetValue]
func (*LimitExpr) ToSQLString ¶
type MyCharset ¶
type MyCharset struct {
IsDefault bool
Default sqltoken.Pos
Charset sqltoken.Pos
Equal bool
Name *Ident
// contains filtered or unexported fields
}
func (*MyCharset) ToSQLString ¶
type MyDataTypeDecoration ¶
type MyDataTypeDecoration interface {
Node
// contains filtered or unexported methods
}
type MyEngine ¶
type MyEngine struct {
Engine sqltoken.Pos
Equal bool
Name *Ident
// contains filtered or unexported fields
}
ENGINE option ( = InnoDB, MyISAM ...)
func (*MyEngine) ToSQLString ¶
type NamedColumnsJoin ¶
type NamedColumnsJoin struct {
ColumnList []*Ident
Using sqltoken.Pos
RParen sqltoken.Pos
// contains filtered or unexported fields
}
func (*NamedColumnsJoin) End ¶
func (n *NamedColumnsJoin) End() sqltoken.Pos
func (*NamedColumnsJoin) Pos ¶
func (n *NamedColumnsJoin) Pos() sqltoken.Pos
func (*NamedColumnsJoin) ToSQLString ¶
func (n *NamedColumnsJoin) ToSQLString() string
type NationalStringLiteral ¶
func NewNationalStringLiteral ¶
func NewNationalStringLiteral(str string) *NationalStringLiteral
func (*NationalStringLiteral) End ¶
func (n *NationalStringLiteral) End() sqltoken.Pos
func (*NationalStringLiteral) Pos ¶
func (n *NationalStringLiteral) Pos() sqltoken.Pos
func (*NationalStringLiteral) ToSQLString ¶
func (n *NationalStringLiteral) ToSQLString() string
func (*NationalStringLiteral) Value ¶
func (n *NationalStringLiteral) Value() interface{}
type NaturalJoin ¶
type NaturalJoin struct {
LeftElement *TableJoinElement
Type *JoinType
RightElement *TableJoinElement
// contains filtered or unexported fields
}
func (*NaturalJoin) End ¶
func (n *NaturalJoin) End() sqltoken.Pos
func (*NaturalJoin) Pos ¶
func (n *NaturalJoin) Pos() sqltoken.Pos
func (*NaturalJoin) ToSQLString ¶
func (n *NaturalJoin) ToSQLString() string
type Node ¶
type Node interface {
ToSQLString() string // convert Node as as sql valid string
Pos() sqltoken.Pos // position of first character belonging to the node
End() sqltoken.Pos // position of last character belonging to the node
WriteTo(w io.Writer) (n int64, err error)
}
AST Node interface. All node types implements this interface.
type NotNullColumnSpec ¶
func (*NotNullColumnSpec) End ¶
func (n *NotNullColumnSpec) End() sqltoken.Pos
func (*NotNullColumnSpec) Pos ¶
func (n *NotNullColumnSpec) Pos() sqltoken.Pos
func (*NotNullColumnSpec) ToSQLString ¶
func (*NotNullColumnSpec) ToSQLString() string
type ObjectName ¶
type ObjectName struct {
Idents []*Ident
}
Table Names (ex public.table_name)
func NewObjectName ¶
func NewObjectName(strs ...string) *ObjectName
func (*ObjectName) End ¶
func (s *ObjectName) End() sqltoken.Pos
func (*ObjectName) Pos ¶
func (s *ObjectName) Pos() sqltoken.Pos
func (*ObjectName) ToSQLString ¶
func (s *ObjectName) ToSQLString() string
type Operator ¶
type Operator struct {
Type OperatorType
From, To sqltoken.Pos
}
func (*Operator) ToSQLString ¶
type OperatorType ¶
type OperatorType int
const ( Plus OperatorType = iota Minus Multiply Divide Modulus Gt Lt GtEq LtEq Eq NotEq And Or Not Like NotLike None )
type OrderByExpr ¶
type OrderByExpr struct {
Expr Node
OrderingPos sqltoken.Pos // ASC / DESC keyword position if ASC != nil
ASC *bool
}
ORDER BY Expr [ASC | DESC]
func (*OrderByExpr) End ¶
func (o *OrderByExpr) End() sqltoken.Pos
func (*OrderByExpr) Pos ¶
func (o *OrderByExpr) Pos() sqltoken.Pos
func (*OrderByExpr) ToSQLString ¶
func (o *OrderByExpr) ToSQLString() string
type PGAlterDataTypeColumnAction ¶
type PGAlterDataTypeColumnAction struct {
Type sqltoken.Pos
DataType Type
// contains filtered or unexported fields
}
postgres only
func (*PGAlterDataTypeColumnAction) End ¶
func (p *PGAlterDataTypeColumnAction) End() sqltoken.Pos
func (*PGAlterDataTypeColumnAction) Pos ¶
func (p *PGAlterDataTypeColumnAction) Pos() sqltoken.Pos
func (*PGAlterDataTypeColumnAction) ToSQLString ¶
func (p *PGAlterDataTypeColumnAction) ToSQLString() string
type PGDropNotNullColumnAction ¶
type PGDropNotNullColumnAction struct {
Drop, Null sqltoken.Pos
// contains filtered or unexported fields
}
func (*PGDropNotNullColumnAction) End ¶
func (p *PGDropNotNullColumnAction) End() sqltoken.Pos
func (*PGDropNotNullColumnAction) Pos ¶
func (p *PGDropNotNullColumnAction) Pos() sqltoken.Pos
func (*PGDropNotNullColumnAction) ToSQLString ¶
func (p *PGDropNotNullColumnAction) ToSQLString() string
type PGSetNotNullColumnAction ¶
type PGSetNotNullColumnAction struct {
Set, Null sqltoken.Pos
// contains filtered or unexported fields
}
func (*PGSetNotNullColumnAction) End ¶
func (p *PGSetNotNullColumnAction) End() sqltoken.Pos
func (*PGSetNotNullColumnAction) Pos ¶
func (p *PGSetNotNullColumnAction) Pos() sqltoken.Pos
func (*PGSetNotNullColumnAction) ToSQLString ¶
func (p *PGSetNotNullColumnAction) ToSQLString() string
type PartitionedJoinTable ¶
type PartitionedJoinTable struct {
Factor TableFactor
ColumnList []*Ident
RParen sqltoken.Pos
// contains filtered or unexported fields
}
func (*PartitionedJoinTable) End ¶
func (p *PartitionedJoinTable) End() sqltoken.Pos
func (*PartitionedJoinTable) Pos ¶
func (p *PartitionedJoinTable) Pos() sqltoken.Pos
func (*PartitionedJoinTable) ToSQLString ¶
func (p *PartitionedJoinTable) ToSQLString() string
type Preceding ¶
type Preceding struct {
Bound *uint64
From sqltoken.Pos // first char position of Bound
Preceding sqltoken.Pos // last char position of PRECEDING
// contains filtered or unexported fields
}
`Bound PRECEDING`
func (*Preceding) ToSQLString ¶
type QualifiedJoin ¶
type QualifiedJoin struct {
LeftElement *TableJoinElement
Type *JoinType
RightElement *TableJoinElement
Spec JoinSpec
// contains filtered or unexported fields
}
func (*QualifiedJoin) End ¶
func (q *QualifiedJoin) End() sqltoken.Pos
func (*QualifiedJoin) Pos ¶
func (q *QualifiedJoin) Pos() sqltoken.Pos
func (*QualifiedJoin) ToSQLString ¶
func (q *QualifiedJoin) ToSQLString() string
type QualifiedWildcard ¶
type QualifiedWildcard struct {
Idents []*Ident
}
`table.*`, schema.table.*
func (*QualifiedWildcard) End ¶
func (s *QualifiedWildcard) End() sqltoken.Pos
func (*QualifiedWildcard) Pos ¶
func (s *QualifiedWildcard) Pos() sqltoken.Pos
func (*QualifiedWildcard) ToSQLString ¶
func (s *QualifiedWildcard) ToSQLString() string
type QualifiedWildcardSelectItem ¶
type QualifiedWildcardSelectItem struct {
Prefix *ObjectName
// contains filtered or unexported fields
}
schema.*
func (*QualifiedWildcardSelectItem) End ¶
func (q *QualifiedWildcardSelectItem) End() sqltoken.Pos
func (*QualifiedWildcardSelectItem) Pos ¶
func (q *QualifiedWildcardSelectItem) Pos() sqltoken.Pos
func (*QualifiedWildcardSelectItem) ToSQLString ¶
func (q *QualifiedWildcardSelectItem) ToSQLString() string
type QueryExpr ¶
type QueryExpr struct {
LParen, RParen sqltoken.Pos
Query *QueryStmt
// contains filtered or unexported fields
}
(QueryStmt)
func (*QueryExpr) ToSQLString ¶
type QueryStmt ¶
type QueryStmt struct {
With sqltoken.Pos // first char position of WITH if CTEs is not blank
CTEs []*CTE
Body SQLSetExpr
OrderBy []*OrderByExpr
Limit *LimitExpr
// contains filtered or unexported fields
}
QueryStmt stmt
func (*QueryStmt) ToSQLString ¶
type Real ¶
func (*Real) ToSQLString ¶
type ReferenceKeyExpr ¶
func (*ReferenceKeyExpr) End ¶
func (r *ReferenceKeyExpr) End() sqltoken.Pos
func (*ReferenceKeyExpr) Pos ¶
func (r *ReferenceKeyExpr) Pos() sqltoken.Pos
func (*ReferenceKeyExpr) ToSQLString ¶
func (r *ReferenceKeyExpr) ToSQLString() string
type ReferencesColumnSpec ¶
type ReferencesColumnSpec struct {
References sqltoken.Pos
RParen sqltoken.Pos
TableName *ObjectName
Columns []*Ident
}
func (*ReferencesColumnSpec) End ¶
func (r *ReferencesColumnSpec) End() sqltoken.Pos
func (*ReferencesColumnSpec) Pos ¶
func (r *ReferencesColumnSpec) Pos() sqltoken.Pos
func (*ReferencesColumnSpec) ToSQLString ¶
func (r *ReferencesColumnSpec) ToSQLString() string
type ReferentialTableConstraint ¶
type ReferentialTableConstraint struct {
Foreign sqltoken.Pos
Columns []*Ident
KeyExpr *ReferenceKeyExpr
// contains filtered or unexported fields
}
func (*ReferentialTableConstraint) End ¶
func (r *ReferentialTableConstraint) End() sqltoken.Pos
func (*ReferentialTableConstraint) Pos ¶
func (r *ReferentialTableConstraint) Pos() sqltoken.Pos
func (*ReferentialTableConstraint) ToSQLString ¶
func (r *ReferentialTableConstraint) ToSQLString() string
type Regclass ¶
func (*Regclass) ToSQLString ¶
type RemoveColumnTableAction ¶
type RemoveColumnTableAction struct {
Name *Ident
Cascade bool
CascadePos sqltoken.Pos
Drop sqltoken.Pos
// contains filtered or unexported fields
}
func (*RemoveColumnTableAction) End ¶
func (r *RemoveColumnTableAction) End() sqltoken.Pos
func (*RemoveColumnTableAction) Pos ¶
func (r *RemoveColumnTableAction) Pos() sqltoken.Pos
func (*RemoveColumnTableAction) ToSQLString ¶
func (r *RemoveColumnTableAction) ToSQLString() string
type RowValueExpr ¶
func (*RowValueExpr) End ¶
func (r *RowValueExpr) End() sqltoken.Pos
func (*RowValueExpr) Pos ¶
func (r *RowValueExpr) Pos() sqltoken.Pos
func (*RowValueExpr) ToSQLString ¶
func (r *RowValueExpr) ToSQLString() string
type SQLSelect ¶
type SQLSelect struct {
Distinct bool
Projection []SQLSelectItem
FromClause []TableReference
WhereClause Node
GroupByClause []Node
HavingClause Node
Select sqltoken.Pos // first position of SELECT
// contains filtered or unexported fields
}
func (*SQLSelect) ToSQLString ¶
type SQLSelectItem ¶
type SQLSelectItem interface {
Node
// contains filtered or unexported methods
}
type SQLSetExpr ¶
type SQLSetExpr interface {
Node
// contains filtered or unexported methods
}
type SQLSetOperator ¶
type SQLSetOperator interface {
Node
// contains filtered or unexported methods
}
type SQLWindowFrameBound ¶
type SQLWindowFrameBound interface {
Node
// contains filtered or unexported methods
}
type SelectExpr ¶
type SelectExpr struct {
Select *SQLSelect
// contains filtered or unexported fields
}
Select
func (*SelectExpr) End ¶
func (s *SelectExpr) End() sqltoken.Pos
func (*SelectExpr) Pos ¶
func (s *SelectExpr) Pos() sqltoken.Pos
func (*SelectExpr) ToSQLString ¶
func (s *SelectExpr) ToSQLString() string
type SetDefaultColumnAction ¶
type SetDefaultColumnAction struct {
Set sqltoken.Pos
Default Node
// contains filtered or unexported fields
}
func (*SetDefaultColumnAction) End ¶
func (s *SetDefaultColumnAction) End() sqltoken.Pos
func (*SetDefaultColumnAction) Pos ¶
func (s *SetDefaultColumnAction) Pos() sqltoken.Pos
func (*SetDefaultColumnAction) ToSQLString ¶
func (s *SetDefaultColumnAction) ToSQLString() string
type SetOperationExpr ¶
type SetOperationExpr struct {
Op SQLSetOperator
All bool
Left SQLSetExpr
Right SQLSetExpr
// contains filtered or unexported fields
}
func (*SetOperationExpr) End ¶
func (s *SetOperationExpr) End() sqltoken.Pos
func (*SetOperationExpr) Pos ¶
func (s *SetOperationExpr) Pos() sqltoken.Pos
func (*SetOperationExpr) ToSQLString ¶
func (s *SetOperationExpr) ToSQLString() string
type SingleQuotedString ¶
func NewSingleQuotedString ¶
func NewSingleQuotedString(str string) *SingleQuotedString
func (*SingleQuotedString) End ¶
func (s *SingleQuotedString) End() sqltoken.Pos
func (*SingleQuotedString) Pos ¶
func (s *SingleQuotedString) Pos() sqltoken.Pos
func (*SingleQuotedString) ToSQLString ¶
func (s *SingleQuotedString) ToSQLString() string
func (*SingleQuotedString) Value ¶
func (s *SingleQuotedString) Value() interface{}
type SmallInt ¶
func (*SmallInt) ToSQLString ¶
type SubQuerySource ¶
type SubQuerySource struct {
SubQuery *QueryStmt
// contains filtered or unexported fields
}
SubQuery Source
func (*SubQuerySource) End ¶
func (s *SubQuerySource) End() sqltoken.Pos
func (*SubQuerySource) Pos ¶
func (s *SubQuerySource) Pos() sqltoken.Pos
func (*SubQuerySource) ToSQLString ¶
func (s *SubQuerySource) ToSQLString() string
type Table ¶
type Table struct {
Name *ObjectName
Alias *Ident
Args []Node
ArgsRParen sqltoken.Pos
WithHints []Node
WithHintsRParen sqltoken.Pos
// contains filtered or unexported fields
}
Table
func (*Table) ToSQLString ¶
type TableConstraint ¶
type TableConstraint struct {
Constraint sqltoken.Pos
Name *Ident
Spec TableConstraintSpec
// contains filtered or unexported fields
}
func (*TableConstraint) End ¶
func (t *TableConstraint) End() sqltoken.Pos
func (*TableConstraint) Pos ¶
func (t *TableConstraint) Pos() sqltoken.Pos
func (*TableConstraint) ToSQLString ¶
func (t *TableConstraint) ToSQLString() string
type TableConstraintSpec ¶
type TableConstraintSpec interface {
Node
// contains filtered or unexported methods
}
type TableElement ¶
type TableElement interface {
Node
// contains filtered or unexported methods
}
type TableFactor ¶
type TableFactor interface {
TableReference
// contains filtered or unexported methods
}
type TableJoinElement ¶
type TableJoinElement struct {
Ref TableReference
// contains filtered or unexported fields
}
func (*TableJoinElement) End ¶
func (t *TableJoinElement) End() sqltoken.Pos
func (*TableJoinElement) Pos ¶
func (t *TableJoinElement) Pos() sqltoken.Pos
func (*TableJoinElement) ToSQLString ¶
func (t *TableJoinElement) ToSQLString() string
type TableOption ¶
type TableOption interface {
Node
// contains filtered or unexported methods
}
type TableReference ¶
type TableReference interface {
Node
// contains filtered or unexported methods
}
type Text ¶
func (*Text) ToSQLString ¶
type Time ¶
func (*Time) ToSQLString ¶
type Timestamp ¶
func (*Timestamp) ToSQLString ¶
type TimestampValue ¶
func NewTimestampValue ¶
func NewTimestampValue(t time.Time) *TimestampValue
func (*TimestampValue) End ¶
func (t *TimestampValue) End() sqltoken.Pos
func (*TimestampValue) Pos ¶
func (t *TimestampValue) Pos() sqltoken.Pos
func (*TimestampValue) ToSQLString ¶
func (t *TimestampValue) ToSQLString() string
func (*TimestampValue) Value ¶
func (t *TimestampValue) Value() interface{}
type UUID ¶
func (*UUID) ToSQLString ¶
type UnboundedFollowing ¶
type UnboundedFollowing struct {
Unbounded sqltoken.Pos // first char position of UNBOUND
Following sqltoken.Pos // last char position of FOLLOWING
// contains filtered or unexported fields
}
func (*UnboundedFollowing) End ¶
func (u *UnboundedFollowing) End() sqltoken.Pos
func (*UnboundedFollowing) Pos ¶
func (u *UnboundedFollowing) Pos() sqltoken.Pos
func (*UnboundedFollowing) ToSQLString ¶
func (*UnboundedFollowing) ToSQLString() string
type UnboundedPreceding ¶
type UnboundedPreceding struct {
Unbounded sqltoken.Pos // first char position of UNBOUND
Preceding sqltoken.Pos // last char position of PRECEDING
// contains filtered or unexported fields
}
func (*UnboundedPreceding) End ¶
func (u *UnboundedPreceding) End() sqltoken.Pos
func (*UnboundedPreceding) Pos ¶
func (u *UnboundedPreceding) Pos() sqltoken.Pos
func (*UnboundedPreceding) ToSQLString ¶
func (*UnboundedPreceding) ToSQLString() string
type UnionOperator ¶
func (*UnionOperator) End ¶
func (u *UnionOperator) End() sqltoken.Pos
func (*UnionOperator) Pos ¶
func (u *UnionOperator) Pos() sqltoken.Pos
func (*UnionOperator) ToSQLString ¶
func (u *UnionOperator) ToSQLString() string
type UniqueColumnSpec ¶
func (*UniqueColumnSpec) End ¶
func (u *UniqueColumnSpec) End() sqltoken.Pos
func (*UniqueColumnSpec) Pos ¶
func (u *UniqueColumnSpec) Pos() sqltoken.Pos
func (*UniqueColumnSpec) ToSQLString ¶
func (u *UniqueColumnSpec) ToSQLString() string
type UniqueTableConstraint ¶
type UniqueTableConstraint struct {
IsPrimary bool
Primary, Unique sqltoken.Pos
RParen sqltoken.Pos
Columns []*Ident
// contains filtered or unexported fields
}
func (*UniqueTableConstraint) End ¶
func (u *UniqueTableConstraint) End() sqltoken.Pos
func (*UniqueTableConstraint) Pos ¶
func (u *UniqueTableConstraint) Pos() sqltoken.Pos
func (*UniqueTableConstraint) ToSQLString ¶
func (u *UniqueTableConstraint) ToSQLString() string
type UnnamedSelectItem ¶
type UnnamedSelectItem struct {
Node Node
// contains filtered or unexported fields
}
func (*UnnamedSelectItem) End ¶
func (u *UnnamedSelectItem) End() sqltoken.Pos
func (*UnnamedSelectItem) Pos ¶
func (u *UnnamedSelectItem) Pos() sqltoken.Pos
func (*UnnamedSelectItem) ToSQLString ¶
func (u *UnnamedSelectItem) ToSQLString() string
type UpdateStmt ¶
type UpdateStmt struct {
Update sqltoken.Pos
TableName *ObjectName
Assignments []*Assignment
Selection Node
// contains filtered or unexported fields
}
func (*UpdateStmt) End ¶
func (u *UpdateStmt) End() sqltoken.Pos
func (*UpdateStmt) Pos ¶
func (u *UpdateStmt) Pos() sqltoken.Pos
func (*UpdateStmt) ToSQLString ¶
func (u *UpdateStmt) ToSQLString() string
type Varbinary ¶
func (*Varbinary) ToSQLString ¶
type VarcharType ¶
func (*VarcharType) End ¶
func (v *VarcharType) End() sqltoken.Pos
func (*VarcharType) Pos ¶
func (v *VarcharType) Pos() sqltoken.Pos
func (*VarcharType) ToSQLString ¶
func (v *VarcharType) ToSQLString() string
type WildcardSelectItem ¶
func (*WildcardSelectItem) End ¶
func (w *WildcardSelectItem) End() sqltoken.Pos
func (*WildcardSelectItem) Pos ¶
func (w *WildcardSelectItem) Pos() sqltoken.Pos
func (*WildcardSelectItem) ToSQLString ¶
func (w *WildcardSelectItem) ToSQLString() string
type WindowFrame ¶
type WindowFrame struct {
Units *WindowFrameUnit
StartBound SQLWindowFrameBound
EndBound SQLWindowFrameBound
}
func (*WindowFrame) End ¶
func (s *WindowFrame) End() sqltoken.Pos
func (*WindowFrame) Pos ¶
func (s *WindowFrame) Pos() sqltoken.Pos
func (*WindowFrame) ToSQLString ¶
func (s *WindowFrame) ToSQLString() string
type WindowFrameUnit ¶
type WindowFrameUnit struct {
From, To sqltoken.Pos
Type WindowFrameUnitType
}
func (*WindowFrameUnit) End ¶
func (s *WindowFrameUnit) End() sqltoken.Pos
func (WindowFrameUnit) FromStr ¶
func (WindowFrameUnit) FromStr(str string) (*WindowFrameUnit, error)
func (*WindowFrameUnit) Pos ¶
func (s *WindowFrameUnit) Pos() sqltoken.Pos
func (*WindowFrameUnit) ToSQLString ¶
func (s *WindowFrameUnit) ToSQLString() string
type WindowFrameUnitType ¶
type WindowFrameUnitType int
const ( RowsUnit WindowFrameUnitType = iota RangeUnit GroupsUnit )
type WindowSpec ¶
type WindowSpec struct {
PartitionBy []Node
OrderBy []*OrderByExpr
WindowsFrame *WindowFrame
Partition, Order sqltoken.Pos
}
func (*WindowSpec) End ¶
func (s *WindowSpec) End() sqltoken.Pos
func (*WindowSpec) Pos ¶
func (s *WindowSpec) Pos() sqltoken.Pos
func (*WindowSpec) ToSQLString ¶
func (s *WindowSpec) ToSQLString() string
Source Files
¶
- alter_column_action_gen.go
- alter_table_action_gen.go
- ast.go
- comment.go
- commentmap.go
- insert_source_gen.go
- join_element_gen.go
- join_spec_gen.go
- my_data_type_decoration_gen.go
- operator.go
- query.go
- sql_select_item_gen.go
- sql_set_expr_gen.go
- sql_set_operator_gen.go
- sql_window_frame_bound_gen.go
- stmt.go
- stmt_gen.go
- table_constraint_spec_gen.go
- table_element_gen.go
- table_factor_gen.go
- table_option.go
- table_option_gen.go
- table_reference_gen.go
- type.go
- value.go
- walk.go
- writer.go