sqlast

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 8 Imported by: 4

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inspect

func Inspect(node Node, f func(node Node) bool)

func NewSize

func NewSize(s uint) *uint

func Walk

func Walk(v Visitor, node Node)

Types

type AddColumnTableAction

type AddColumnTableAction struct {
	Add    sqltoken.Pos
	Column *ColumnDef
	// contains filtered or unexported fields
}

func (*AddColumnTableAction) End

func (*AddColumnTableAction) Pos

func (*AddColumnTableAction) ToSQLString

func (a *AddColumnTableAction) ToSQLString() string

func (*AddColumnTableAction) WriteTo

func (a *AddColumnTableAction) WriteTo(w io.Writer) (int64, error)

type AddConstraintTableAction

type AddConstraintTableAction struct {
	Add        sqltoken.Pos
	Constraint *TableConstraint
	// contains filtered or unexported fields
}

func (*AddConstraintTableAction) End

func (*AddConstraintTableAction) Pos

func (*AddConstraintTableAction) ToSQLString

func (a *AddConstraintTableAction) ToSQLString() string

func (*AddConstraintTableAction) WriteTo

func (a *AddConstraintTableAction) WriteTo(w io.Writer) (int64, error)

type AliasSelectItem

type AliasSelectItem struct {
	Expr  Node
	Alias *Ident
	// contains filtered or unexported fields
}

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

func (*AliasSelectItem) WriteTo

func (a *AliasSelectItem) WriteTo(w io.Writer) (int64, error)

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 (*AlterColumnTableAction) Pos

func (*AlterColumnTableAction) ToSQLString

func (a *AlterColumnTableAction) ToSQLString() string

func (*AlterColumnTableAction) WriteTo

func (a *AlterColumnTableAction) WriteTo(w io.Writer) (int64, error)

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

func (*AlterTableStmt) WriteTo

func (a *AlterTableStmt) WriteTo(w io.Writer) (int64, error)

type Array

type Array struct {
	Ty     Type
	RParen sqltoken.Pos
}

func (*Array) End

func (a *Array) End() sqltoken.Pos

func (*Array) Pos

func (a *Array) Pos() sqltoken.Pos

func (*Array) ToSQLString

func (a *Array) ToSQLString() string

func (*Array) WriteTo

func (a *Array) WriteTo(w io.Writer) (int64, error)

type Assignment

type Assignment struct {
	ID    *Ident
	Value Node
}

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

func (*Assignment) WriteTo

func (a *Assignment) WriteTo(w io.Writer) (int64, error)

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

func (*AutoIncrement) WriteTo

func (a *AutoIncrement) WriteTo(w io.Writer) (int64, error)

type Between

type Between struct {
	Expr    Node
	Negated bool
	Low     Node
	High    Node
}

`Expr [ NOT ] BETWEEN [ LOW expr ] AND [ HIGH expr]`

func (*Between) End

func (s *Between) End() sqltoken.Pos

func (*Between) Pos

func (s *Between) Pos() sqltoken.Pos

func (*Between) ToSQLString

func (s *Between) ToSQLString() string

func (*Between) WriteTo

func (s *Between) WriteTo(w io.Writer) (int64, error)

type BigInt

type BigInt struct {
	From, To   sqltoken.Pos
	IsUnsigned bool
	Unsigned   sqltoken.Pos
}

func (*BigInt) End

func (b *BigInt) End() sqltoken.Pos

func (*BigInt) Pos

func (b *BigInt) Pos() sqltoken.Pos

func (*BigInt) ToSQLString

func (b *BigInt) ToSQLString() string

func (*BigInt) WriteTo

func (b *BigInt) WriteTo(w io.Writer) (int64, error)

type Binary

type Binary struct {
	Size           uint
	Binary, RParen sqltoken.Pos
}

func (*Binary) End

func (b *Binary) End() sqltoken.Pos

func (*Binary) Pos

func (b *Binary) Pos() sqltoken.Pos

func (*Binary) ToSQLString

func (b *Binary) ToSQLString() string

func (*Binary) WriteTo

func (b *Binary) WriteTo(w io.Writer) (int64, error)

type BinaryExpr

type BinaryExpr struct {
	Left  Node
	Op    *Operator
	Right Node
}

`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

func (*BinaryExpr) WriteTo

func (s *BinaryExpr) WriteTo(w io.Writer) (int64, error)

type Blob

type Blob struct {
	Size         uint
	Blob, RParen sqltoken.Pos
}

func (*Blob) End

func (b *Blob) End() sqltoken.Pos

func (*Blob) Pos

func (b *Blob) Pos() sqltoken.Pos

func (*Blob) ToSQLString

func (b *Blob) ToSQLString() string

func (*Blob) WriteTo

func (b *Blob) WriteTo(w io.Writer) (int64, error)

type Boolean

type Boolean struct {
	From, To sqltoken.Pos
}

func (*Boolean) End

func (b *Boolean) End() sqltoken.Pos

func (*Boolean) Pos

func (b *Boolean) Pos() sqltoken.Pos

func (*Boolean) ToSQLString

func (*Boolean) ToSQLString() string

func (*Boolean) WriteTo

func (*Boolean) WriteTo(w io.Writer) (int64, error)

type BooleanValue

type BooleanValue struct {
	From, To sqltoken.Pos
	Boolean  bool
}

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{}

func (*BooleanValue) WriteTo

func (b *BooleanValue) WriteTo(w io.Writer) (int64, error)

type Bytea

type Bytea struct {
	From, To sqltoken.Pos
}

func (*Bytea) End

func (b *Bytea) End() sqltoken.Pos

func (*Bytea) Pos

func (b *Bytea) Pos() sqltoken.Pos

func (*Bytea) ToSQLString

func (*Bytea) ToSQLString() string

func (*Bytea) WriteTo

func (*Bytea) WriteTo(w io.Writer) (int64, error)

type CTE

type CTE struct {
	Alias  *Ident
	Query  *QueryStmt
	RParen sqltoken.Pos
}

CTE

func (*CTE) End

func (c *CTE) End() sqltoken.Pos

func (*CTE) Pos

func (c *CTE) Pos() sqltoken.Pos

func (*CTE) ToSQLString

func (c *CTE) ToSQLString() string

func (*CTE) WriteTo

func (c *CTE) WriteTo(w io.Writer) (int64, error)

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) End

func (s *CaseExpr) End() sqltoken.Pos

func (*CaseExpr) Pos

func (s *CaseExpr) Pos() sqltoken.Pos

func (*CaseExpr) ToSQLString

func (s *CaseExpr) ToSQLString() string

func (*CaseExpr) WriteTo

func (s *CaseExpr) WriteTo(w io.Writer) (int64, error)

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) End

func (s *Cast) End() sqltoken.Pos

func (*Cast) Pos

func (s *Cast) Pos() sqltoken.Pos

func (*Cast) ToSQLString

func (s *Cast) ToSQLString() string

func (*Cast) WriteTo

func (s *Cast) WriteTo(w io.Writer) (int64, error)

type CharType

type CharType struct {
	Size             *uint
	From, To, RParen sqltoken.Pos
}

func (*CharType) End

func (c *CharType) End() sqltoken.Pos

func (*CharType) Pos

func (c *CharType) Pos() sqltoken.Pos

func (*CharType) ToSQLString

func (c *CharType) ToSQLString() string

func (*CharType) WriteTo

func (c *CharType) WriteTo(w io.Writer) (int64, error)

type CheckColumnSpec

type CheckColumnSpec struct {
	Expr   Node
	Check  sqltoken.Pos
	RParen sqltoken.Pos
}

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

func (*CheckColumnSpec) WriteTo

func (c *CheckColumnSpec) WriteTo(w io.Writer) (n int64, err error)

type CheckTableConstraint

type CheckTableConstraint struct {
	Check  sqltoken.Pos
	RParen sqltoken.Pos
	Expr   Node
	// contains filtered or unexported fields
}

func (*CheckTableConstraint) End

func (*CheckTableConstraint) Pos

func (*CheckTableConstraint) ToSQLString

func (c *CheckTableConstraint) ToSQLString() string

func (*CheckTableConstraint) WriteTo

func (c *CheckTableConstraint) WriteTo(w io.Writer) (int64, error)

type Clob

type Clob struct {
	Size         uint
	Clob, RParen sqltoken.Pos
}

func (*Clob) End

func (c *Clob) End() sqltoken.Pos

func (*Clob) Pos

func (c *Clob) Pos() sqltoken.Pos

func (*Clob) ToSQLString

func (c *Clob) ToSQLString() string

func (*Clob) WriteTo

func (c *Clob) WriteTo(w io.Writer) (int64, error)

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

func (*ColumnConstraint) WriteTo

func (c *ColumnConstraint) WriteTo(w io.Writer) (int64, error)

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) End

func (c *ColumnDef) End() sqltoken.Pos

func (*ColumnDef) Pos

func (c *ColumnDef) Pos() sqltoken.Pos

func (*ColumnDef) ToSQLString

func (c *ColumnDef) ToSQLString() string

func (*ColumnDef) WriteTo

func (c *ColumnDef) WriteTo(w io.Writer) (int64, error)

type Comment

type Comment struct {
	Text     string
	From, To sqltoken.Pos
}

func (*Comment) End

func (c *Comment) End() sqltoken.Pos

func (*Comment) Pos

func (c *Comment) Pos() sqltoken.Pos

func (*Comment) ToSQLString

func (c *Comment) ToSQLString() string

func (*Comment) WriteTo

func (c *Comment) WriteTo(w io.Writer) (int64, error)

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

func (*CommentGroup) WriteTo

func (c *CommentGroup) WriteTo(w io.Writer) (n int64, err error)

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

func (*CompoundIdent) WriteTo

func (s *CompoundIdent) WriteTo(w io.Writer) (int64, error)

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

func (*ConstructorSource) WriteTo

func (c *ConstructorSource) WriteTo(w io.Writer) (int64, error)

type CopyStmt

type CopyStmt struct {
	Copy      sqltoken.Pos
	TableName *ObjectName
	Columns   []*Ident
	Values    []*string
	// contains filtered or unexported fields
}

TODO Remove CopyStmt

func (*CopyStmt) End

func (c *CopyStmt) End() sqltoken.Pos

TODO

func (*CopyStmt) Pos

func (c *CopyStmt) Pos() sqltoken.Pos

func (*CopyStmt) ToSQLString

func (c *CopyStmt) ToSQLString() string

func (*CopyStmt) WriteTo

func (c *CopyStmt) WriteTo(w io.Writer) (int64, error)

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

func (*CreateIndexStmt) WriteTo

func (c *CreateIndexStmt) WriteTo(w io.Writer) (int64, error)

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

func (*CreateTableStmt) WriteTo

func (c *CreateTableStmt) WriteTo(w io.Writer) (int64, error)

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

func (*CreateViewStmt) WriteTo

func (c *CreateViewStmt) WriteTo(w io.Writer) (int64, error)

type CrossJoin

type CrossJoin struct {
	Reference TableReference
	Factor    TableFactor
	// contains filtered or unexported fields
}

func (*CrossJoin) End

func (c *CrossJoin) End() sqltoken.Pos

func (*CrossJoin) Pos

func (c *CrossJoin) Pos() sqltoken.Pos

func (*CrossJoin) ToSQLString

func (c *CrossJoin) ToSQLString() string

func (*CrossJoin) WriteTo

func (c *CrossJoin) WriteTo(w io.Writer) (int64, error)

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

func (*CurrentRow) WriteTo

func (c *CurrentRow) WriteTo(w io.Writer) (int64, error)

type Custom

type Custom struct {
	Ty *ObjectName
}

func (*Custom) End

func (c *Custom) End() sqltoken.Pos

func (*Custom) Pos

func (c *Custom) Pos() sqltoken.Pos

func (*Custom) ToSQLString

func (c *Custom) ToSQLString() string

func (*Custom) WriteTo

func (c *Custom) WriteTo(w io.Writer) (int64, error)

type Date

type Date struct {
	From, To sqltoken.Pos
}

func (*Date) End

func (d *Date) End() sqltoken.Pos

func (*Date) Pos

func (d *Date) Pos() sqltoken.Pos

func (*Date) ToSQLString

func (*Date) ToSQLString() string

func (*Date) WriteTo

func (*Date) WriteTo(w io.Writer) (int64, error)

type DateTimeValue

type DateTimeValue struct {
	From, To sqltoken.Pos
	DateTime time.Time
}

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{}

func (*DateTimeValue) WriteTo

func (d *DateTimeValue) WriteTo(w io.Writer) (int64, error)

type DateValue

type DateValue struct {
	From, To sqltoken.Pos
	Date     time.Time
}

func (*DateValue) End

func (d *DateValue) End() sqltoken.Pos

func (*DateValue) Pos

func (d *DateValue) Pos() sqltoken.Pos

func (*DateValue) ToSQLString

func (d *DateValue) ToSQLString() string

func (*DateValue) Value

func (d *DateValue) Value() interface{}

func (*DateValue) WriteTo

func (d *DateValue) WriteTo(w io.Writer) (int64, error)

type Decimal

type Decimal struct {
	Precision       *uint
	Scale           *uint
	Numeric, RParen sqltoken.Pos
	IsUnsigned      bool
	Unsigned        sqltoken.Pos
}

func (*Decimal) End

func (d *Decimal) End() sqltoken.Pos

func (*Decimal) Pos

func (d *Decimal) Pos() sqltoken.Pos

func (*Decimal) ToSQLString

func (d *Decimal) ToSQLString() string

func (*Decimal) WriteTo

func (d *Decimal) WriteTo(w io.Writer) (int64, error)

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

func (*DeleteStmt) WriteTo

func (d *DeleteStmt) WriteTo(w io.Writer) (int64, error)

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) End

func (d *Derived) End() sqltoken.Pos

func (*Derived) Pos

func (d *Derived) Pos() sqltoken.Pos

func (*Derived) ToSQLString

func (d *Derived) ToSQLString() string

func (*Derived) WriteTo

func (d *Derived) WriteTo(w io.Writer) (int64, error)

type Double

type Double struct {
	From, To sqltoken.Pos
}

func (*Double) End

func (d *Double) End() sqltoken.Pos

func (*Double) Pos

func (d *Double) Pos() sqltoken.Pos

func (*Double) ToSQLString

func (*Double) ToSQLString() string

func (*Double) WriteTo

func (*Double) WriteTo(w io.Writer) (int64, error)

type DoubleValue

type DoubleValue struct {
	From, To sqltoken.Pos
	Double   float64
}

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{}

func (*DoubleValue) WriteTo

func (d *DoubleValue) WriteTo(w io.Writer) (int64, error)

type DropConstraintTableAction

type DropConstraintTableAction struct {
	Name       *Ident
	Drop       sqltoken.Pos
	Cascade    bool
	CascadePos sqltoken.Pos
	// contains filtered or unexported fields
}

func (*DropConstraintTableAction) End

func (*DropConstraintTableAction) Pos

func (*DropConstraintTableAction) ToSQLString

func (d *DropConstraintTableAction) ToSQLString() string

func (*DropConstraintTableAction) WriteTo

func (d *DropConstraintTableAction) WriteTo(w io.Writer) (int64, error)

type DropDefaultColumnAction

type DropDefaultColumnAction struct {
	Drop, Default sqltoken.Pos
	// contains filtered or unexported fields
}

func (*DropDefaultColumnAction) End

func (*DropDefaultColumnAction) Pos

func (*DropDefaultColumnAction) ToSQLString

func (*DropDefaultColumnAction) ToSQLString() string

func (*DropDefaultColumnAction) WriteTo

func (d *DropDefaultColumnAction) WriteTo(w io.Writer) (int64, error)

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

func (*DropIndexStmt) WriteTo

func (d *DropIndexStmt) WriteTo(w io.Writer) (int64, error)

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

func (*DropTableStmt) WriteTo

func (d *DropTableStmt) WriteTo(w io.Writer) (int64, error)

type ExceptOperator

type ExceptOperator struct {
	From, To sqltoken.Pos
	// contains filtered or unexported fields
}

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

func (*ExceptOperator) WriteTo

func (e *ExceptOperator) WriteTo(w io.Writer) (n int64, err error)

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) End

func (s *Exists) End() sqltoken.Pos

func (*Exists) Pos

func (s *Exists) Pos() sqltoken.Pos

func (*Exists) ToSQLString

func (s *Exists) ToSQLString() string

func (*Exists) WriteTo

func (s *Exists) WriteTo(w io.Writer) (int64, error)

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

func (*ExplainStmt) WriteTo

func (e *ExplainStmt) WriteTo(w io.Writer) (int64, error)

type File

type File struct {
	Stmts    []Stmt
	Comments []*CommentGroup
}

func (*File) End

func (f *File) End() sqltoken.Pos

func (*File) Pos

func (f *File) Pos() sqltoken.Pos

func (*File) ToSQLString

func (f *File) ToSQLString() string

func (*File) WriteTo

func (f *File) WriteTo(w io.Writer) (int64, error)

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) End

func (f *Float) End() sqltoken.Pos

func (*Float) Pos

func (f *Float) Pos() sqltoken.Pos

func (*Float) ToSQLString

func (f *Float) ToSQLString() string

func (*Float) WriteTo

func (f *Float) WriteTo(w io.Writer) (int64, error)

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) End

func (f *Following) End() sqltoken.Pos

func (*Following) Pos

func (f *Following) Pos() sqltoken.Pos

func (*Following) ToSQLString

func (f *Following) ToSQLString() string

func (*Following) WriteTo

func (f *Following) WriteTo(w io.Writer) (n int64, err error)

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) End

func (s *Function) End() sqltoken.Pos

func (*Function) Pos

func (s *Function) Pos() sqltoken.Pos

func (*Function) ToSQLString

func (s *Function) ToSQLString() string

func (*Function) WriteTo

func (s *Function) WriteTo(w io.Writer) (int64, error)

type Ident

type Ident struct {
	Value    string
	From, To sqltoken.Pos
}

Identifier

func NewIdent

func NewIdent(str string) *Ident

func NewIdentWithPos

func NewIdentWithPos(str string, from, to sqltoken.Pos) *Ident

func (*Ident) End

func (s *Ident) End() sqltoken.Pos

func (*Ident) Pos

func (s *Ident) Pos() sqltoken.Pos

func (*Ident) ToSQLString

func (s *Ident) ToSQLString() string

func (*Ident) WriteStringTo

func (s *Ident) WriteStringTo(w io.StringWriter) (int64, error)

func (*Ident) WriteTo

func (s *Ident) WriteTo(w io.Writer) (int64, error)

type InList

type InList struct {
	Expr    Node
	List    []Node
	Negated bool
	RParen  sqltoken.Pos
}

`Expr IN (List...)`

func (*InList) End

func (s *InList) End() sqltoken.Pos

func (*InList) Pos

func (s *InList) Pos() sqltoken.Pos

func (*InList) ToSQLString

func (s *InList) ToSQLString() string

func (*InList) WriteTo

func (s *InList) WriteTo(w io.Writer) (int64, error)

type InSubQuery

type InSubQuery struct {
	Expr     Node
	SubQuery *QueryStmt
	Negated  bool
	RParen   sqltoken.Pos
}

`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

func (*InSubQuery) WriteTo

func (s *InSubQuery) WriteTo(w io.Writer) (int64, error)

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

func (*InsertStmt) WriteTo

func (i *InsertStmt) WriteTo(w io.Writer) (int64, error)

type Int

type Int struct {
	From, To   sqltoken.Pos
	IsUnsigned bool
	Unsigned   sqltoken.Pos
}

func (*Int) End

func (i *Int) End() sqltoken.Pos

func (*Int) Pos

func (i *Int) Pos() sqltoken.Pos

func (*Int) ToSQLString

func (i *Int) ToSQLString() string

func (*Int) WriteTo

func (i *Int) WriteTo(w io.Writer) (int64, error)

type IntersectOperator

type IntersectOperator struct {
	From, To sqltoken.Pos
	// contains filtered or unexported fields
}

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

func (*IntersectOperator) WriteTo

func (i *IntersectOperator) WriteTo(w io.Writer) (n int64, err error)

type IsNotNull

type IsNotNull struct {
	X Node
}

`X IS NOT NULL`

func (*IsNotNull) End

func (s *IsNotNull) End() sqltoken.Pos

func (*IsNotNull) Pos

func (s *IsNotNull) Pos() sqltoken.Pos

func (*IsNotNull) ToSQLString

func (s *IsNotNull) ToSQLString() string

func (*IsNotNull) WriteTo

func (s *IsNotNull) WriteTo(w io.Writer) (int64, error)

type IsNull

type IsNull struct {
	X Node
}

` X IS NULL`

func (*IsNull) End

func (s *IsNull) End() sqltoken.Pos

func (*IsNull) Pos

func (s *IsNull) Pos() sqltoken.Pos

func (*IsNull) ToSQLString

func (s *IsNull) ToSQLString() string

func (*IsNull) WriteTo

func (s *IsNull) WriteTo(w io.Writer) (int64, error)

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

func (*JoinCondition) WriteTo

func (j *JoinCondition) WriteTo(w io.Writer) (int64, error)

type JoinElement

type JoinElement interface {
	Node
	// contains filtered or unexported methods
}

type JoinSpec

type JoinSpec interface {
	Node
	// contains filtered or unexported methods
}

type JoinType

type JoinType struct {
	Condition JoinTypeCondition
	From, To  sqltoken.Pos
}

func (*JoinType) End

func (j *JoinType) End() sqltoken.Pos

func (*JoinType) Pos

func (j *JoinType) Pos() sqltoken.Pos

func (*JoinType) ToSQLString

func (j *JoinType) ToSQLString() string

func (*JoinType) WriteTo

func (j *JoinType) WriteTo(w io.Writer) (int64, error)

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) End

func (l *LimitExpr) End() sqltoken.Pos

func (*LimitExpr) Pos

func (l *LimitExpr) Pos() sqltoken.Pos

func (*LimitExpr) ToSQLString

func (l *LimitExpr) ToSQLString() string

func (*LimitExpr) WriteTo

func (l *LimitExpr) WriteTo(w io.Writer) (int64, error)

type LongValue

type LongValue struct {
	From, To sqltoken.Pos
	Long     int64
}

func NewLongValue

func NewLongValue(i int64) *LongValue

func (*LongValue) End

func (l *LongValue) End() sqltoken.Pos

func (*LongValue) Pos

func (l *LongValue) Pos() sqltoken.Pos

func (*LongValue) ToSQLString

func (l *LongValue) ToSQLString() string

func (*LongValue) Value

func (l *LongValue) Value() interface{}

func (*LongValue) WriteTo

func (l *LongValue) WriteTo(w io.Writer) (int64, error)

type MyCharset

type MyCharset struct {
	IsDefault bool
	Default   sqltoken.Pos
	Charset   sqltoken.Pos
	Equal     bool
	Name      *Ident
	// contains filtered or unexported fields
}

func (*MyCharset) End

func (m *MyCharset) End() sqltoken.Pos

func (*MyCharset) Pos

func (m *MyCharset) Pos() sqltoken.Pos

func (*MyCharset) ToSQLString

func (m *MyCharset) ToSQLString() string

func (*MyCharset) WriteTo

func (m *MyCharset) WriteTo(w io.Writer) (int64, error)

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) End

func (m *MyEngine) End() sqltoken.Pos

func (*MyEngine) Pos

func (m *MyEngine) Pos() sqltoken.Pos

func (*MyEngine) ToSQLString

func (m *MyEngine) ToSQLString() string

func (*MyEngine) WriteTo

func (m *MyEngine) WriteTo(w io.Writer) (int64, error)

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

func (*NamedColumnsJoin) WriteTo

func (n *NamedColumnsJoin) WriteTo(w io.Writer) (int64, error)

type NationalStringLiteral

type NationalStringLiteral struct {
	From, To sqltoken.Pos
	String   string
}

func NewNationalStringLiteral

func NewNationalStringLiteral(str string) *NationalStringLiteral

func (*NationalStringLiteral) End

func (*NationalStringLiteral) Pos

func (*NationalStringLiteral) ToSQLString

func (n *NationalStringLiteral) ToSQLString() string

func (*NationalStringLiteral) Value

func (n *NationalStringLiteral) Value() interface{}

func (*NationalStringLiteral) WriteTo

func (n *NationalStringLiteral) WriteTo(w io.Writer) (int64, error)

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

func (*NaturalJoin) WriteTo

func (n *NaturalJoin) WriteTo(w io.Writer) (int64, error)

type Nested

type Nested struct {
	AST            Node
	LParen, RParen sqltoken.Pos
}

(AST)

func (*Nested) End

func (s *Nested) End() sqltoken.Pos

func (*Nested) Pos

func (s *Nested) Pos() sqltoken.Pos

func (*Nested) ToSQLString

func (s *Nested) ToSQLString() string

func (*Nested) WriteTo

func (s *Nested) WriteTo(w io.Writer) (int64, error)

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

type NotNullColumnSpec struct {
	Not, Null sqltoken.Pos
}

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

func (*NotNullColumnSpec) WriteTo

func (*NotNullColumnSpec) WriteTo(w io.Writer) (int64, error)

type NullValue

type NullValue struct {
	From, To sqltoken.Pos
}

func NewNullValue

func NewNullValue() *NullValue

func (*NullValue) End

func (n *NullValue) End() sqltoken.Pos

func (*NullValue) Pos

func (n *NullValue) Pos() sqltoken.Pos

func (*NullValue) ToSQLString

func (n *NullValue) ToSQLString() string

func (*NullValue) Value

func (n *NullValue) Value() interface{}

func (*NullValue) WriteTo

func (*NullValue) WriteTo(w io.Writer) (int64, error)

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

func (*ObjectName) WriteTo

func (s *ObjectName) WriteTo(w io.Writer) (int64, error)

type Operator

type Operator struct {
	Type     OperatorType
	From, To sqltoken.Pos
}

func (*Operator) End

func (o *Operator) End() sqltoken.Pos

func (*Operator) Pos

func (o *Operator) Pos() sqltoken.Pos

func (*Operator) ToSQLString

func (o *Operator) ToSQLString() string

func (*Operator) WriteTo

func (o *Operator) WriteTo(w io.Writer) (int64, error)

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

func (*OrderByExpr) WriteTo

func (o *OrderByExpr) WriteTo(w io.Writer) (int64, error)

type PGAlterDataTypeColumnAction

type PGAlterDataTypeColumnAction struct {
	Type     sqltoken.Pos
	DataType Type
	// contains filtered or unexported fields
}

postgres only

func (*PGAlterDataTypeColumnAction) End

func (*PGAlterDataTypeColumnAction) Pos

func (*PGAlterDataTypeColumnAction) ToSQLString

func (p *PGAlterDataTypeColumnAction) ToSQLString() string

func (*PGAlterDataTypeColumnAction) WriteTo

func (p *PGAlterDataTypeColumnAction) WriteTo(w io.Writer) (int64, error)

type PGDropNotNullColumnAction

type PGDropNotNullColumnAction struct {
	Drop, Null sqltoken.Pos
	// contains filtered or unexported fields
}

func (*PGDropNotNullColumnAction) End

func (*PGDropNotNullColumnAction) Pos

func (*PGDropNotNullColumnAction) ToSQLString

func (p *PGDropNotNullColumnAction) ToSQLString() string

func (*PGDropNotNullColumnAction) WriteTo

func (p *PGDropNotNullColumnAction) WriteTo(w io.Writer) (int64, error)

type PGSetNotNullColumnAction

type PGSetNotNullColumnAction struct {
	Set, Null sqltoken.Pos
	// contains filtered or unexported fields
}

func (*PGSetNotNullColumnAction) End

func (*PGSetNotNullColumnAction) Pos

func (*PGSetNotNullColumnAction) ToSQLString

func (p *PGSetNotNullColumnAction) ToSQLString() string

func (*PGSetNotNullColumnAction) WriteTo

func (p *PGSetNotNullColumnAction) WriteTo(w io.Writer) (int64, error)

type PartitionedJoinTable

type PartitionedJoinTable struct {
	Factor     TableFactor
	ColumnList []*Ident
	RParen     sqltoken.Pos
	// contains filtered or unexported fields
}

func (*PartitionedJoinTable) End

func (*PartitionedJoinTable) Pos

func (*PartitionedJoinTable) ToSQLString

func (p *PartitionedJoinTable) ToSQLString() string

func (*PartitionedJoinTable) WriteTo

func (p *PartitionedJoinTable) WriteTo(w io.Writer) (int64, error)

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) End

func (p *Preceding) End() sqltoken.Pos

func (*Preceding) Pos

func (p *Preceding) Pos() sqltoken.Pos

func (*Preceding) ToSQLString

func (p *Preceding) ToSQLString() string

func (*Preceding) WriteTo

func (p *Preceding) WriteTo(w io.Writer) (n int64, err error)

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

func (*QualifiedJoin) WriteTo

func (q *QualifiedJoin) WriteTo(w io.Writer) (int64, error)

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

func (*QualifiedWildcard) WriteTo

func (s *QualifiedWildcard) WriteTo(w io.Writer) (int64, error)

type QualifiedWildcardSelectItem

type QualifiedWildcardSelectItem struct {
	Prefix *ObjectName
	// contains filtered or unexported fields
}

schema.*

func (*QualifiedWildcardSelectItem) End

func (*QualifiedWildcardSelectItem) Pos

func (*QualifiedWildcardSelectItem) ToSQLString

func (q *QualifiedWildcardSelectItem) ToSQLString() string

func (*QualifiedWildcardSelectItem) WriteTo

func (q *QualifiedWildcardSelectItem) WriteTo(w io.Writer) (int64, error)

type QueryExpr

type QueryExpr struct {
	LParen, RParen sqltoken.Pos
	Query          *QueryStmt
	// contains filtered or unexported fields
}

(QueryStmt)

func (*QueryExpr) End

func (q *QueryExpr) End() sqltoken.Pos

func (*QueryExpr) Pos

func (q *QueryExpr) Pos() sqltoken.Pos

func (*QueryExpr) ToSQLString

func (q *QueryExpr) ToSQLString() string

func (*QueryExpr) WriteTo

func (q *QueryExpr) WriteTo(w io.Writer) (int64, error)

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) End

func (q *QueryStmt) End() sqltoken.Pos

func (*QueryStmt) Pos

func (q *QueryStmt) Pos() sqltoken.Pos

func (*QueryStmt) ToSQLString

func (q *QueryStmt) ToSQLString() string

func (*QueryStmt) WriteTo

func (q *QueryStmt) WriteTo(w io.Writer) (int64, error)

type Real

type Real struct {
	From, To   sqltoken.Pos
	IsUnsigned bool
	Unsigned   sqltoken.Pos
}

func (*Real) End

func (r *Real) End() sqltoken.Pos

func (*Real) Pos

func (r *Real) Pos() sqltoken.Pos

func (*Real) ToSQLString

func (r *Real) ToSQLString() string

func (*Real) WriteTo

func (r *Real) WriteTo(w io.Writer) (int64, error)

type ReferenceKeyExpr

type ReferenceKeyExpr struct {
	TableName *Ident
	Columns   []*Ident
	RParen    sqltoken.Pos
}

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

func (*ReferenceKeyExpr) WriteTo

func (r *ReferenceKeyExpr) WriteTo(w io.Writer) (int64, error)

type ReferencesColumnSpec

type ReferencesColumnSpec struct {
	References sqltoken.Pos
	RParen     sqltoken.Pos
	TableName  *ObjectName
	Columns    []*Ident
}

func (*ReferencesColumnSpec) End

func (*ReferencesColumnSpec) Pos

func (*ReferencesColumnSpec) ToSQLString

func (r *ReferencesColumnSpec) ToSQLString() string

func (*ReferencesColumnSpec) WriteTo

func (r *ReferencesColumnSpec) WriteTo(w io.Writer) (int64, error)

type ReferentialTableConstraint

type ReferentialTableConstraint struct {
	Foreign sqltoken.Pos
	Columns []*Ident
	KeyExpr *ReferenceKeyExpr
	// contains filtered or unexported fields
}

func (*ReferentialTableConstraint) End

func (*ReferentialTableConstraint) Pos

func (*ReferentialTableConstraint) ToSQLString

func (r *ReferentialTableConstraint) ToSQLString() string

func (*ReferentialTableConstraint) WriteTo

func (r *ReferentialTableConstraint) WriteTo(w io.Writer) (int64, error)

type Regclass

type Regclass struct {
	From, To sqltoken.Pos
}

func (*Regclass) End

func (r *Regclass) End() sqltoken.Pos

func (*Regclass) Pos

func (r *Regclass) Pos() sqltoken.Pos

func (*Regclass) ToSQLString

func (*Regclass) ToSQLString() string

func (*Regclass) WriteTo

func (*Regclass) WriteTo(w io.Writer) (int64, error)

type RemoveColumnTableAction

type RemoveColumnTableAction struct {
	Name       *Ident
	Cascade    bool
	CascadePos sqltoken.Pos
	Drop       sqltoken.Pos
	// contains filtered or unexported fields
}

func (*RemoveColumnTableAction) End

func (*RemoveColumnTableAction) Pos

func (*RemoveColumnTableAction) ToSQLString

func (r *RemoveColumnTableAction) ToSQLString() string

func (*RemoveColumnTableAction) WriteTo

func (r *RemoveColumnTableAction) WriteTo(w io.Writer) (int64, error)

type RowValueExpr

type RowValueExpr struct {
	Values         []Node
	LParen, RParen sqltoken.Pos
}

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

func (*RowValueExpr) WriteTo

func (r *RowValueExpr) WriteTo(w io.Writer) (int64, error)

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) End

func (s *SQLSelect) End() sqltoken.Pos

func (*SQLSelect) Pos

func (s *SQLSelect) Pos() sqltoken.Pos

func (*SQLSelect) ToSQLString

func (s *SQLSelect) ToSQLString() string

func (*SQLSelect) WriteTo

func (s *SQLSelect) WriteTo(w io.Writer) (int64, error)

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

func (*SelectExpr) WriteTo

func (s *SelectExpr) WriteTo(w io.Writer) (int64, error)

type SetDefaultColumnAction

type SetDefaultColumnAction struct {
	Set     sqltoken.Pos
	Default Node
	// contains filtered or unexported fields
}

func (*SetDefaultColumnAction) End

func (*SetDefaultColumnAction) Pos

func (*SetDefaultColumnAction) ToSQLString

func (s *SetDefaultColumnAction) ToSQLString() string

func (*SetDefaultColumnAction) WriteTo

func (s *SetDefaultColumnAction) WriteTo(w io.Writer) (int64, error)

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

func (*SetOperationExpr) WriteTo

func (s *SetOperationExpr) WriteTo(w io.Writer) (n int64, err error)

type SingleQuotedString

type SingleQuotedString struct {
	From, To sqltoken.Pos
	String   string
}

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{}

func (*SingleQuotedString) WriteTo

func (s *SingleQuotedString) WriteTo(w io.Writer) (int64, error)

type SmallInt

type SmallInt struct {
	From, To   sqltoken.Pos
	IsUnsigned bool
	Unsigned   sqltoken.Pos
}

func (*SmallInt) End

func (s *SmallInt) End() sqltoken.Pos

func (*SmallInt) Pos

func (s *SmallInt) Pos() sqltoken.Pos

func (*SmallInt) ToSQLString

func (s *SmallInt) ToSQLString() string

func (*SmallInt) WriteTo

func (s *SmallInt) WriteTo(w io.Writer) (int64, error)

type Stmt

type Stmt interface {
	Node
	// contains filtered or unexported methods
}

type SubQuery

type SubQuery struct {
	RParen, LParen sqltoken.Pos
	Query          *QueryStmt
}

(QueryStmt)

func (*SubQuery) End

func (s *SubQuery) End() sqltoken.Pos

func (*SubQuery) Pos

func (s *SubQuery) Pos() sqltoken.Pos

func (*SubQuery) ToSQLString

func (s *SubQuery) ToSQLString() string

func (*SubQuery) WriteTo

func (s *SubQuery) WriteTo(w io.Writer) (int64, error)

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

func (*SubQuerySource) WriteTo

func (s *SubQuerySource) WriteTo(w io.Writer) (int64, error)

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) End

func (t *Table) End() sqltoken.Pos

func (*Table) Pos

func (t *Table) Pos() sqltoken.Pos

func (*Table) ToSQLString

func (t *Table) ToSQLString() string

func (*Table) WriteTo

func (t *Table) WriteTo(w io.Writer) (int64, error)

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

func (*TableConstraint) WriteTo

func (t *TableConstraint) WriteTo(w io.Writer) (int64, error)

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

func (*TableJoinElement) WriteTo

func (t *TableJoinElement) WriteTo(w io.Writer) (int64, error)

type TableOption

type TableOption interface {
	Node
	// contains filtered or unexported methods
}

type TableReference

type TableReference interface {
	Node
	// contains filtered or unexported methods
}

type Text

type Text struct {
	From, To sqltoken.Pos
}

func (*Text) End

func (t *Text) End() sqltoken.Pos

func (*Text) Pos

func (t *Text) Pos() sqltoken.Pos

func (*Text) ToSQLString

func (*Text) ToSQLString() string

func (*Text) WriteTo

func (*Text) WriteTo(w io.Writer) (int64, error)

type Time

type Time struct {
	From, To sqltoken.Pos
}

func (*Time) End

func (t *Time) End() sqltoken.Pos

func (*Time) Pos

func (t *Time) Pos() sqltoken.Pos

func (*Time) ToSQLString

func (*Time) ToSQLString() string

func (*Time) WriteTo

func (*Time) WriteTo(w io.Writer) (int64, error)

type TimeValue

type TimeValue struct {
	From, To sqltoken.Pos
	Time     time.Time
}

func NewTimeValue

func NewTimeValue(t time.Time) *TimeValue

func (*TimeValue) End

func (t *TimeValue) End() sqltoken.Pos

func (*TimeValue) Pos

func (t *TimeValue) Pos() sqltoken.Pos

func (*TimeValue) ToSQLString

func (t *TimeValue) ToSQLString() string

func (*TimeValue) Value

func (t *TimeValue) Value() interface{}

func (*TimeValue) WriteTo

func (t *TimeValue) WriteTo(w io.Writer) (int64, error)

type Timestamp

type Timestamp struct {
	WithTimeZone bool
	Timestamp    sqltoken.Pos
	Zone         sqltoken.Pos
}

func (*Timestamp) End

func (t *Timestamp) End() sqltoken.Pos

func (*Timestamp) Pos

func (t *Timestamp) Pos() sqltoken.Pos

func (*Timestamp) ToSQLString

func (t *Timestamp) ToSQLString() string

func (*Timestamp) WriteTo

func (t *Timestamp) WriteTo(w io.Writer) (int64, error)

type TimestampValue

type TimestampValue struct {
	From, To  sqltoken.Pos
	Timestamp time.Time
}

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{}

func (*TimestampValue) WriteTo

func (t *TimestampValue) WriteTo(w io.Writer) (int64, error)

type Type

type Type interface {
	Node
}

type UUID

type UUID struct {
	From, To sqltoken.Pos
}

func (*UUID) End

func (u *UUID) End() sqltoken.Pos

func (*UUID) Pos

func (u *UUID) Pos() sqltoken.Pos

func (*UUID) ToSQLString

func (*UUID) ToSQLString() string

func (*UUID) WriteTo

func (u *UUID) WriteTo(w io.Writer) (int64, error)

type UnaryExpr

type UnaryExpr struct {
	From sqltoken.Pos // first position of Op
	Op   *Operator
	Expr Node
}

Op Expr

func (*UnaryExpr) End

func (s *UnaryExpr) End() sqltoken.Pos

func (*UnaryExpr) Pos

func (s *UnaryExpr) Pos() sqltoken.Pos

func (*UnaryExpr) ToSQLString

func (s *UnaryExpr) ToSQLString() string

func (*UnaryExpr) WriteTo

func (s *UnaryExpr) WriteTo(w io.Writer) (int64, error)

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

func (*UnboundedFollowing) WriteTo

func (u *UnboundedFollowing) WriteTo(w io.Writer) (int64, error)

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

func (*UnboundedPreceding) WriteTo

func (u *UnboundedPreceding) WriteTo(w io.Writer) (int64, error)

type UnionOperator

type UnionOperator struct {
	From, To sqltoken.Pos
	// contains filtered or unexported fields
}

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

func (*UnionOperator) WriteTo

func (u *UnionOperator) WriteTo(w io.Writer) (int64, error)

type UniqueColumnSpec

type UniqueColumnSpec struct {
	IsPrimaryKey bool
	Primary, Key sqltoken.Pos
	Unique       sqltoken.Pos
}

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

func (*UniqueColumnSpec) WriteTo

func (u *UniqueColumnSpec) WriteTo(w io.Writer) (int64, error)

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 (*UniqueTableConstraint) Pos

func (*UniqueTableConstraint) ToSQLString

func (u *UniqueTableConstraint) ToSQLString() string

func (*UniqueTableConstraint) WriteTo

func (u *UniqueTableConstraint) WriteTo(w io.Writer) (n int64, err error)

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

func (*UnnamedSelectItem) WriteTo

func (u *UnnamedSelectItem) WriteTo(w io.Writer) (int64, error)

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

func (*UpdateStmt) WriteTo

func (u *UpdateStmt) WriteTo(w io.Writer) (int64, error)

type Value

type Value interface {
	Value() interface{}
	Node
}

type Varbinary

type Varbinary struct {
	Size              uint
	Varbinary, RParen sqltoken.Pos
}

func (*Varbinary) End

func (v *Varbinary) End() sqltoken.Pos

func (*Varbinary) Pos

func (v *Varbinary) Pos() sqltoken.Pos

func (*Varbinary) ToSQLString

func (v *Varbinary) ToSQLString() string

func (*Varbinary) WriteTo

func (v *Varbinary) WriteTo(w io.Writer) (int64, error)

type VarcharType

type VarcharType struct {
	Size                       *uint
	Character, Varying, RParen sqltoken.Pos
}

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

func (*VarcharType) WriteTo

func (v *VarcharType) WriteTo(w io.Writer) (int64, error)

type Visitor

type Visitor interface {
	Visit(node Node) Visitor
}

type Wildcard

type Wildcard struct {
	Wildcard sqltoken.Pos
}

`*` Node.

func (*Wildcard) End

func (s *Wildcard) End() sqltoken.Pos

func (*Wildcard) Pos

func (s *Wildcard) Pos() sqltoken.Pos

func (Wildcard) ToSQLString

func (s Wildcard) ToSQLString() string

func (*Wildcard) WriteTo

func (s *Wildcard) WriteTo(w io.Writer) (int64, error)

type WildcardSelectItem

type WildcardSelectItem struct {
	From, To sqltoken.Pos
	// contains filtered or unexported fields
}

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

func (*WildcardSelectItem) WriteTo

func (*WildcardSelectItem) WriteTo(w io.Writer) (int64, error)

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

func (*WindowFrame) WriteTo

func (s *WindowFrame) WriteTo(w io.Writer) (int64, error)

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

func (*WindowFrameUnit) WriteTo

func (s *WindowFrameUnit) WriteTo(w io.Writer) (int64, error)

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

func (*WindowSpec) WriteTo

func (s *WindowSpec) WriteTo(w io.Writer) (int64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL