ast

package
v0.0.0-...-65fd79d Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ast implements an abstract syntax tree that represents SQL statements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlterTableStmt

type AlterTableStmt struct {
	Alter         token.Token
	Table         token.Token
	SchemaName    token.Token
	Period        token.Token
	TableName     token.Token
	Rename        token.Token
	To            token.Token
	NewTableName  token.Token
	Column        token.Token
	ColumnName    token.Token
	NewColumnName token.Token
	Add           token.Token
	ColumnDef     *ColumnDef
}

AlterTableStmt as in the SQLite grammar.

type AnalyzeStmt

type AnalyzeStmt struct {
	Analyze          token.Token
	SchemaName       token.Token
	TableOrIndexName token.Token
	Period           token.Token
}

AnalyzeStmt as in the SQLite grammar.

type AttachStmt

type AttachStmt struct {
	Attach     token.Token
	Database   token.Token
	Expr       *Expr
	As         token.Token
	SchemaName token.Token
}

AttachStmt as in the SQLite grammar.

type BeginStmt

type BeginStmt struct {
	Begin       token.Token
	Deferred    token.Token
	Immediate   token.Token
	Exclusive   token.Token
	Transaction token.Token
}

BeginStmt as in the SQLite grammar.

type ColumnConstraint

type ColumnConstraint struct {
	Constraint       token.Token
	Name             token.Token
	Primary          token.Token
	Key              token.Token
	Asc              token.Token
	Desc             token.Token
	ConflictClause   *ConflictClause
	Autoincrement    token.Token
	Not              token.Token
	Null             token.Token
	Unique           token.Token
	Check            token.Token
	LeftParen        token.Token
	Expr             *Expr
	RightParen       token.Token
	Default          token.Token
	SignedNumber     *SignedNumber
	LiteralValue     token.Token
	Collate          token.Token
	CollationName    token.Token
	ForeignKeyClause *ForeignKeyClause
	Generated        token.Token
	Always           token.Token
	As               token.Token
	Stored           token.Token
	Virtual          token.Token
}

ColumnConstraint as in the SQLite grammar.

type ColumnDef

type ColumnDef struct {
	ColumnName       token.Token
	TypeName         *TypeName
	ColumnConstraint []*ColumnConstraint
}

ColumnDef as in the SQLite grammar.

type ColumnNameList

type ColumnNameList struct {
	LeftParen  token.Token
	ColumnName []token.Token
	RightParen token.Token
}

ColumnNameList as in the SQLite grammar.

type CommitStmt

type CommitStmt struct {
	Commit      token.Token
	End         token.Token
	Transaction token.Token
}

CommitStmt as in the SQLite grammar.

type CommonTableExpression

type CommonTableExpression struct {
	TableName   token.Token
	LeftParen1  token.Token
	ColumnName  []token.Token
	RightParen1 token.Token
	As          token.Token
	LeftParen2  token.Token
	SelectStmt  *SelectStmt
	RightParen2 token.Token
}

CommonTableExpression as in the SQLite grammar.

type CompoundOperator

type CompoundOperator struct {
	Union     token.Token
	All       token.Token
	Intersect token.Token
	Except    token.Token
}

CompoundOperator as in the SQLite grammar.

type ConflictClause

type ConflictClause struct {
	On       token.Token
	Conflict token.Token
	Rollback token.Token
	Abort    token.Token
	Fail     token.Token
	Ignore   token.Token
	Replace  token.Token
}

ConflictClause as in the SQLite grammar.

type CreateIndexStmt

type CreateIndexStmt struct {
	Create         token.Token
	Unique         token.Token
	Index          token.Token
	If             token.Token
	Not            token.Token
	Exists         token.Token
	SchemaName     token.Token
	Period         token.Token
	IndexName      token.Token
	On             token.Token
	TableName      token.Token
	LeftParen      token.Token
	IndexedColumns []*IndexedColumn
	RightParen     token.Token
	Where          token.Token
	Expr           *Expr
}

CreateIndexStmt as in the SQLite grammar.

type CreateTableStmt

type CreateTableStmt struct {
	Create          token.Token
	Temp            token.Token
	Temporary       token.Token
	Table           token.Token
	If              token.Token
	Not             token.Token
	Exists          token.Token
	SchemaName      token.Token
	Period          token.Token
	TableName       token.Token
	LeftParen       token.Token
	ColumnDef       []*ColumnDef
	TableConstraint []*TableConstraint
	RightParen      token.Token
	Without         token.Token
	Rowid           token.Token
	As              token.Token
	SelectStmt      *SelectStmt
}

CreateTableStmt as in the SQLite grammar.

type CreateTriggerStmt

type CreateTriggerStmt struct {
	Create      token.Token
	Temp        token.Token
	Temporary   token.Token
	Trigger     token.Token
	If          token.Token
	Not         token.Token
	Exists      token.Token
	SchemaName  token.Token
	Period      token.Token
	TriggerName token.Token
	Before      token.Token
	After       token.Token
	Instead     token.Token
	Of1         token.Token
	Delete      token.Token
	Insert      token.Token
	Update      token.Token
	Of2         token.Token
	ColumnName  []token.Token
	On          token.Token
	TableName   token.Token
	For         token.Token
	Each        token.Token
	Row         token.Token
	When        token.Token
	Expr        *Expr
	Begin       token.Token
	UpdateStmt  []*UpdateStmt
	InsertStmt  []*InsertStmt
	DeleteStmt  []*DeleteStmt
	SelectStmt  []*SelectStmt
	End         token.Token
}

CreateTriggerStmt as in the SQLite grammar.

type CreateViewStmt

type CreateViewStmt struct {
	Create     token.Token
	Temp       token.Token
	Temporary  token.Token
	View       token.Token
	If         token.Token
	Not        token.Token
	Exists     token.Token
	SchemaName token.Token
	Period     token.Token
	ViewName   token.Token
	LeftParen  token.Token
	ColumnName []token.Token
	RightParen token.Token
	As         token.Token
	SelectStmt *SelectStmt
}

CreateViewStmt as in the SQLite grammar.

type CreateVirtualTableStmt

type CreateVirtualTableStmt struct {
	Create         token.Token
	Virtual        token.Token
	Table          token.Token
	If             token.Token
	Not            token.Token
	Exists         token.Token
	SchemaName     token.Token
	Period         token.Token
	TableName      token.Token
	Using          token.Token
	ModuleName     token.Token
	LeftParen      token.Token
	ModuleArgument []token.Token
	RightParen     token.Token
}

CreateVirtualTableStmt as in the SQLite grammar.

type CteTableName

type CteTableName struct {
	TableName  token.Token
	LeftParen  token.Token
	ColumnName []token.Token
	RightParen token.Token
}

CteTableName as in the SQLite grammar.

type DeleteStmt

type DeleteStmt struct {
	WithClause         *WithClause
	Delete             token.Token
	From               token.Token
	QualifiedTableName *QualifiedTableName
	Where              token.Token
	Expr               *Expr
}

DeleteStmt as in the SQLite grammar.

type DeleteStmtLimited

type DeleteStmtLimited struct {
	*DeleteStmt
	Order        token.Token
	By           token.Token
	OrderingTerm []*OrderingTerm
	Limit        token.Token
	Expr1        *Expr
	Offset       token.Token
	Comma        token.Token
	Expr2        *Expr
}

DeleteStmtLimited as in the SQLite grammar.

type DetachStmt

type DetachStmt struct {
	Detach     token.Token
	Database   token.Token
	SchemaName token.Token
}

DetachStmt as in the SQLite grammar.

type DropIndexStmt

type DropIndexStmt struct {
	Drop       token.Token
	Index      token.Token
	If         token.Token
	Exists     token.Token
	SchemaName token.Token
	Period     token.Token
	IndexName  token.Token
}

DropIndexStmt as in the SQLite grammar.

type DropTableStmt

type DropTableStmt struct {
	Drop       token.Token
	Table      token.Token
	If         token.Token
	Exists     token.Token
	SchemaName token.Token
	Period     token.Token
	TableName  token.Token
}

DropTableStmt as in the SQLite grammar.

type DropTriggerStmt

type DropTriggerStmt struct {
	Drop        token.Token
	Trigger     token.Token
	If          token.Token
	Exists      token.Token
	SchemaName  token.Token
	Period      token.Token
	TriggerName token.Token
}

DropTriggerStmt as in the SQLite grammar.

type DropViewStmt

type DropViewStmt struct {
	Drop       token.Token
	View       token.Token
	If         token.Token
	Exists     token.Token
	SchemaName token.Token
	Period     token.Token
	ViewName   token.Token
}

DropViewStmt as in the SQLite grammar.

type Expr

type Expr struct {
	LiteralValue   token.Token
	SchemaName     token.Token
	Period1        token.Token
	TableName      token.Token
	Period2        token.Token
	ColumnName     token.Token
	UnaryOperator  token.Token
	Expr1          *Expr
	BinaryOperator token.Token
	Expr2          *Expr
	FunctionName   token.Token
	LeftParen      token.Token
	Asterisk       token.Token
	Distinct       token.Token
	Expr           []*Expr
	RightParen     token.Token
	FilterClause   *FilterClause
	OverClause     *OverClause
	Cast           token.Token
	As             token.Token
	TypeName       *TypeName
	Collate        token.Token
	CollationName  token.Token
	Not            token.Token
	Like           token.Token
	Glob           token.Token
	Regexp         token.Token
	Match          token.Token
	Escape         token.Token
	Expr3          *Expr
	Isnull         token.Token
	Notnull        token.Token
	Null           token.Token
	Is             token.Token
	Between        token.Token
	And            token.Token
	In             token.Token
	SelectStmt     *SelectStmt
	TableFunction  token.Token
	Exists         token.Token
	Case           token.Token
	WhenThenClause []*WhenThenClause
	Else           token.Token
	End            token.Token
	RaiseFunction  *RaiseFunction
}

Expr as in the SQLite grammar.

type FilterClause

type FilterClause struct {
	Filter     token.Token
	LeftParen  token.Token
	Where      token.Token
	Expr       *Expr
	RightParen token.Token
}

FilterClause as in the SQLite grammar.

type ForeignKeyClause

type ForeignKeyClause struct {
	References           token.Token
	ForeignTable         token.Token
	LeftParen            token.Token
	ColumnName           []token.Token
	RightParen           token.Token
	ForeignKeyClauseCore []*ForeignKeyClauseCore
	Not                  token.Token
	Deferrable           token.Token
	Initially            token.Token
	Deferred             token.Token
	Immediate            token.Token
}

ForeignKeyClause as in the SQLite grammar.

type ForeignKeyClauseCore

type ForeignKeyClauseCore struct {
	On       token.Token
	Delete   token.Token
	Update   token.Token
	Set      token.Token
	Null     token.Token
	Default  token.Token
	Cascade  token.Token
	Restrict token.Token
	No       token.Token
	Action   token.Token
	Match    token.Token
	Name     token.Token
}

ForeignKeyClauseCore as in the SQLite grammar.

type FrameSpec

type FrameSpec struct {
	Range      token.Token
	Rows       token.Token
	Groups     token.Token
	Between    token.Token
	Unbounded1 token.Token
	Preceding1 token.Token
	Expr1      *Expr
	Current1   token.Token
	Row1       token.Token
	Following1 token.Token
	And        token.Token
	Expr2      *Expr
	Preceding2 token.Token
	Current2   token.Token
	Row2       token.Token
	Following2 token.Token
	Unbounded2 token.Token
	Exclude    token.Token
	No         token.Token
	Others     token.Token
	Current3   token.Token
	Row3       token.Token
	Group      token.Token
	Ties       token.Token
}

FrameSpec as in the SQLite grammar.

type IndexedColumn

type IndexedColumn struct {
	ColumnName    token.Token
	Expr          *Expr
	Collate       token.Token
	CollationName token.Token
	Asc           token.Token
	Desc          token.Token
}

IndexedColumn as in the SQLite grammar.

type InsertStmt

type InsertStmt struct {
	WithClause               *WithClause
	Insert                   token.Token
	Or                       token.Token
	Replace                  token.Token
	Rollback                 token.Token
	Abort                    token.Token
	Fail                     token.Token
	Ignore                   token.Token
	Into                     token.Token
	SchemaName               token.Token
	Period                   token.Token
	TableName                token.Token
	As                       token.Token
	Alias                    token.Token
	LeftParen                token.Token
	ColumnName               []token.Token
	RightParen               token.Token
	Values                   token.Token
	SelectStmt               *SelectStmt
	Default                  token.Token
	ParenthesizedExpressions []*ParenthesizedExpressions
	UpsertClause             *UpsertClause
}

InsertStmt as in the SQLite grammar.

type JoinClause

type JoinClause struct {
	TableOrSubquery *TableOrSubquery
	JoinClausePart  []*JoinClausePart
}

JoinClause as in the SQLite grammar.

type JoinClausePart

type JoinClausePart struct {
	JoinOperator    *JoinOperator
	TableOrSubquery *TableOrSubquery
	JoinConstraint  *JoinConstraint
}

JoinClausePart as in the SQLite grammar.

type JoinConstraint

type JoinConstraint struct {
	On         token.Token
	Expr       *Expr
	Using      token.Token
	LeftParen  token.Token
	ColumnName []token.Token
	RightParen token.Token
}

JoinConstraint as in the SQLite grammar.

type JoinOperator

type JoinOperator struct {
	Comma   token.Token
	Natural token.Token
	Left    token.Token
	Outer   token.Token
	Inner   token.Token
	Cross   token.Token
	Join    token.Token
}

JoinOperator as in the SQLite grammar.

type NamedWindow

type NamedWindow struct {
	WindowName token.Token
	As         token.Token
	WindowDefn *WindowDefn
}

NamedWindow as in the SQLite grammar.

type OrderingTerm

type OrderingTerm struct {
	Expr          *Expr
	Collate       token.Token
	CollationName token.Token
	Asc           token.Token
	Desc          token.Token
	Nulls         token.Token
	First         token.Token
	Last          token.Token
}

OrderingTerm as in the SQLite grammar.

type OverClause

type OverClause struct {
	Over           token.Token
	WindowName     token.Token
	LeftParen      token.Token
	BaseWindowName token.Token
	Partition      token.Token
	By             token.Token
	Expr           []*Expr
	Order          token.Token
	OrderingTerm   []*OrderingTerm
	FrameSpec      *FrameSpec
	RightParen     token.Token
}

OverClause as in the SQLite grammar.

type ParenthesizedExpressions

type ParenthesizedExpressions struct {
	LeftParen  token.Token
	Exprs      []*Expr
	RightParen token.Token
}

ParenthesizedExpressions as in the SQLite grammar.

type QualifiedTableName

type QualifiedTableName struct {
	SchemaName token.Token
	Period     token.Token
	TableName  token.Token
	As         token.Token
	Alias      token.Token
	Not        token.Token
	Indexed    token.Token
	By         token.Token
	IndexName  token.Token
}

QualifiedTableName as in the SQLite grammar.

type RaiseFunction

type RaiseFunction struct {
	Raise        token.Token
	LeftParen    token.Token
	Ignore       token.Token
	Rollback     token.Token
	Abort        token.Token
	Fail         token.Token
	Comma        token.Token
	ErrorMessage token.Token
	RightParen   token.Token
}

RaiseFunction as in the SQLite grammar.

type ReIndexStmt

type ReIndexStmt struct {
	ReIndex          token.Token
	CollationName    token.Token
	SchemaName       token.Token
	Period           token.Token
	TableOrIndexName token.Token
}

ReIndexStmt as in the SQLite grammar.

type RecursiveCte

type RecursiveCte struct {
	CteTableName *CteTableName
	As           token.Token
	LeftParen    token.Token
	SelectStmt   *SelectStmt
	RightParen   token.Token
}

RecursiveCte as in the SQLite grammar.

type ReleaseStmt

type ReleaseStmt struct {
	Release       token.Token
	Savepoint     token.Token
	SavepointName token.Token
}

ReleaseStmt as in the SQLite grammar.

type ResultColumn

type ResultColumn struct {
	Expr        *Expr
	As          token.Token
	ColumnAlias token.Token
	Asterisk    token.Token
	TableName   token.Token
	Period      token.Token
}

ResultColumn as in the SQLite grammar.

type RollbackStmt

type RollbackStmt struct {
	Rollback      token.Token
	Transaction   token.Token
	To            token.Token
	Savepoint     token.Token
	SavepointName token.Token
}

RollbackStmt as in the SQLite grammar.

type SQLStmt

type SQLStmt struct {
	Explain token.Token
	Query   token.Token
	Plan    token.Token

	AlterTableStmt         *AlterTableStmt
	AnalyzeStmt            *AnalyzeStmt
	AttachStmt             *AttachStmt
	BeginStmt              *BeginStmt
	CommitStmt             *CommitStmt
	CreateIndexStmt        *CreateIndexStmt
	CreateTableStmt        *CreateTableStmt
	CreateTriggerStmt      *CreateTriggerStmt
	CreateViewStmt         *CreateViewStmt
	CreateVirtualTableStmt *CreateVirtualTableStmt
	DeleteStmt             *DeleteStmt
	DeleteStmtLimited      *DeleteStmtLimited
	DetachStmt             *DetachStmt
	DropIndexStmt          *DropIndexStmt
	DropTableStmt          *DropTableStmt
	DropTriggerStmt        *DropTriggerStmt
	DropViewStmt           *DropViewStmt
	InsertStmt             *InsertStmt
	ReIndexStmt            *ReIndexStmt
	ReleaseStmt            *ReleaseStmt
	RollbackStmt           *RollbackStmt
	SavepointStmt          *SavepointStmt
	SelectStmt             *SelectStmt
	UpdateStmt             *UpdateStmt
	UpdateStmtLimited      *UpdateStmtLimited
	VacuumStmt             *VacuumStmt
}

SQLStmt as in the SQLite grammar.

type SavepointStmt

type SavepointStmt struct {
	Savepoint     token.Token
	SavepointName token.Token
}

SavepointStmt as in the SQLite grammar.

type SelectCore

type SelectCore struct {
	Select                   token.Token
	Distinct                 token.Token
	All                      token.Token
	ResultColumn             []*ResultColumn
	From                     token.Token
	JoinClause               *JoinClause
	TableOrSubquery          []*TableOrSubquery
	Where                    token.Token
	Expr1                    *Expr
	Group                    token.Token
	By                       token.Token
	Expr2                    []*Expr
	Having                   token.Token
	Expr3                    *Expr
	Window                   token.Token
	NamedWindow              []*NamedWindow
	Values                   token.Token
	ParenthesizedExpressions []*ParenthesizedExpressions
	CompoundOperator         *CompoundOperator
}

SelectCore as in the SQLite grammar.

type SelectStmt

type SelectStmt struct {
	WithClause   *WithClause
	SelectCore   []*SelectCore
	Order        token.Token
	By           token.Token
	OrderingTerm []*OrderingTerm
	Limit        token.Token
	Expr1        *Expr
	Offset       token.Token
	Comma        token.Token
	Expr2        *Expr
}

SelectStmt as in the SQLite grammar.

type SignedNumber

type SignedNumber struct {
	Sign           token.Token
	NumericLiteral token.Token
}

SignedNumber as in the SQLite grammar.

type TableConstraint

type TableConstraint struct {
	Constraint       token.Token
	Name             token.Token
	Primary          token.Token
	Key              token.Token
	Unique           token.Token
	LeftParen        token.Token
	RightParen       token.Token
	IndexedColumn    []*IndexedColumn
	ConflictClause   *ConflictClause
	Check            token.Token
	Expr             *Expr
	Foreign          token.Token
	ColumnName       []token.Token
	ForeignKeyClause *ForeignKeyClause
}

TableConstraint as in the SQLite grammar.

type TableOrSubquery

type TableOrSubquery struct {
	SchemaName        token.Token
	Period            token.Token
	TableName         token.Token
	As                token.Token
	TableAlias        token.Token
	Not               token.Token
	Indexed           token.Token
	By                token.Token
	IndexName         token.Token
	TableFunctionName token.Token
	LeftParen         token.Token
	Expr              []*Expr
	RightParen        token.Token
	JoinClause        *JoinClause
	TableOrSubquery   []*TableOrSubquery
	SelectStmt        *SelectStmt
}

TableOrSubquery as in the SQLite grammar.

type TypeName

type TypeName struct {
	Name          []token.Token
	LeftParen     token.Token
	SignedNumber1 *SignedNumber
	Comma         token.Token
	SignedNumber2 *SignedNumber
	RightParen    token.Token
}

TypeName as in the SQLite grammar.

type UpdateSetter

type UpdateSetter struct {
	ColumnName     token.Token
	ColumnNameList *ColumnNameList
	Assign         token.Token
	Expr           *Expr
}

UpdateSetter as in the SQLite grammar.

type UpdateStmt

type UpdateStmt struct {
	WithClause         *WithClause
	Update             token.Token
	Or                 token.Token
	Rollback           token.Token
	Abort              token.Token
	Replace            token.Token
	Fail               token.Token
	Ignore             token.Token
	QualifiedTableName *QualifiedTableName
	Set                token.Token
	UpdateSetter       []*UpdateSetter
	Where              token.Token
	Expr               *Expr
}

UpdateStmt as in the SQLite grammar.

type UpdateStmtLimited

type UpdateStmtLimited struct {
	*UpdateStmt
	Order        token.Token
	By           token.Token
	OrderingTerm []*OrderingTerm
	Limit        token.Token
	Expr1        *Expr
	Offset       token.Token
	Comma        token.Token
	Expr2        *Expr
}

UpdateStmtLimited as in the SQLite grammar.

type UpsertClause

type UpsertClause struct {
	On            token.Token
	Conflict      token.Token
	LeftParen     token.Token
	IndexedColumn []*IndexedColumn
	RightParen    token.Token
	Where1        token.Token
	Expr1         *Expr
	Do            token.Token
	Nothing       token.Token
	Update        token.Token
	Set           token.Token
	UpdateSetter  []*UpdateSetter
	Where2        token.Token
	Expr2         *Expr
}

UpsertClause as in the SQLite grammar.

type VacuumStmt

type VacuumStmt struct {
	Vacuum     token.Token
	SchemaName token.Token
	Into       token.Token
	Filename   token.Token
}

VacuumStmt as in the SQLite grammar.

type WhenThenClause

type WhenThenClause struct {
	When  token.Token
	Expr1 *Expr
	Then  token.Token
	Expr2 *Expr
}

WhenThenClause as in the SQLite grammar

type WindowDefn

type WindowDefn struct {
	LeftParen      token.Token
	BaseWindowName token.Token
	Partition      token.Token
	By1            token.Token
	Expr           []*Expr
	Order          token.Token
	By2            token.Token
	OrderingTerm   []*OrderingTerm
	FrameSpec      *FrameSpec
	RightParen     token.Token
}

WindowDefn as in the SQLite grammar.

type WithClause

type WithClause struct {
	With         token.Token
	Recursive    token.Token
	RecursiveCte []*RecursiveCte
}

WithClause as in the SQLite grammar.

Jump to

Keyboard shortcuts

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