parser

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2019 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EOF = -(iota + 1)
	Uncategorized
)
View Source
const (
	TokenFrom   = IDENTIFIER
	TokenTo     = SUBSTITUTION_OP
	KeywordFrom = SELECT
	KeywordTo   = JSON_OBJECT
)
View Source
const (
	VariableSign            = '@'
	EnvironmentVariableSign = '%'
	ExternalCommandSign     = '$'
	RuntimeInformationSign  = '#'

	SubstitutionOperator = ":="

	BeginExpression = '{'
	EndExpression   = '}'
)
View Source
const ABSOLUTE = 57444
View Source
const ADD = 57373
View Source
const AFTER = 57379
View Source
const AGGREGATE = 57466
View Source
const AGGREGATE_FUNCTION = 57484
View Source
const ALL = 57407
View Source
const ALTER = 57375
View Source
const ANALYTIC_FUNCTION = 57486
View Source
const AND = 57411
View Source
const ANY = 57408
View Source
const AS = 57368
View Source
const ASC = 57389
View Source
const BEFORE = 57380
View Source
const BEGIN = 57467
View Source
const BETWEEN = 57414
View Source
const BOOLEAN = 57350
View Source
const BREAK = 57452
View Source
const BY = 57388
View Source
const CASE = 57426
View Source
const CHDIR = 57459
View Source
const CLOSE = 57440
View Source
const COMMIT = 57449
View Source
const COMPARISON_OP = 57489
View Source
const CONTINUE = 57451
View Source
const COUNT = 57482
View Source
const CREATE = 57372
View Source
const CROSS = 57400
View Source
const CSV = 57476
View Source
const CURRENT = 57424
View Source
const CURSOR = 57436
View Source
const DATETIME = 57352
View Source
const DECLARE = 57435
View Source
const DEFAULT = 57381
View Source
const DELETE = 57363
View Source
const DESC = 57390
View Source
const DISPOSE = 57441
View Source
const DISTINCT = 57418
View Source
const DO = 57433
View Source
const DROP = 57374
View Source
const DUAL = 57369
View Source
const ECHO = 57454
View Source
const ELSE = 57432
View Source
const ELSEIF = 57428
View Source
const END = 57434
View Source
const ENVIRONMENT_VARIABLE = 57355
View Source
const EXCEPT = 57406
View Source
const EXECUTE = 57458
View Source
const EXISTS = 57409
View Source
const EXIT = 57453
View Source
const EXTERNAL_COMMAND = 57357
View Source
const FETCH = 57438
View Source
const FIRST = 57377
View Source
const FIXED = 57478
View Source
const FLAG = 57354
View Source
const FLOAT = 57349
View Source
const FOLLOWING = 57423
View Source
const FOR = 57437
View Source
const FROM = 57359
View Source
const FULL = 57399
View Source
const FUNCTION = 57465
View Source
const FUNCTION_NTH = 57487
View Source
const FUNCTION_WITH_INS = 57488
View Source
const GROUP = 57386
View Source
const HAVING = 57387
View Source
const IDENTIFIER = 57346
View Source
const IF = 57427
View Source
const IGNORE = 57469
View Source
const IN = 57410
View Source
const INNER = 57395
View Source
const INSERT = 57365
View Source
const INTEGER = 57348
View Source
const INTERSECT = 57405
View Source
const INTO = 57366
View Source
const IS = 57416
View Source
const JOIN = 57394
View Source
const JSON = 57477
View Source
const JSON_OBJECT = 57483
View Source
const JSON_ROW = 57480
View Source
const JSON_TABLE = 57481
View Source
const LAST = 57378
View Source
const LEFT = 57397
View Source
const LIKE = 57415
View Source
const LIMIT = 57391
View Source
const LIST_FUNCTION = 57485
View Source
const LTSV = 57479
View Source
const NATURAL = 57403
View Source
const NEXT = 57442
View Source
const NOT = 57413
View Source
const NULL = 57417
View Source
const NULLS = 57474
View Source
const OFFSET = 57392
View Source
const ON = 57401
View Source
const OPEN = 57439
View Source
const OR = 57412
View Source
const ORDER = 57385
View Source
const OUTER = 57396
View Source
const OVER = 57448
View Source
const PARTITION = 57447
View Source
const PERCENT = 57393
View Source
const PRECEDING = 57422
View Source
const PRINT = 57455
View Source
const PRINTF = 57456
View Source
const PRIOR = 57443
View Source
const PWD = 57460
View Source
const RANGE = 57420
View Source
const RECURSIVE = 57371
View Source
const RELATIVE = 57445
View Source
const RELOAD = 57461
View Source
const REMOVE = 57462
View Source
const RENAME = 57382
View Source
const RETURN = 57468
View Source
const RIGHT = 57398
View Source
const ROLLBACK = 57450
View Source
const ROW = 57425
View Source
const ROWS = 57475
View Source
const RUNTIME_INFORMATION = 57356
View Source
const SELECT = 57358
View Source
const SEPARATOR = 57446
View Source
const SET = 57361
View Source
const SHOW = 57472
View Source
const SOURCE = 57457
View Source
const STDIN = 57370
View Source
const STRING = 57347
View Source
const STRING_OP = 57490
View Source
const SUBSTITUTION_OP = 57491
View Source
const SYNTAX = 57463
View Source
const TABLE = 57376
View Source
const TERNARY = 57351
View Source
const THEN = 57431
View Source
const TIES = 57473
View Source
const TO = 57383
View Source
const TRIGGER = 57464
View Source
const TokenUndefined = 0
View Source
const UMINUS = 57492
View Source
const UNBOUNDED = 57421
View Source
const UNION = 57404
View Source
const UNSET = 57362
View Source
const UPDATE = 57360
View Source
const UPLUS = 57493
View Source
const USING = 57402
View Source
const VALUES = 57367
View Source
const VAR = 57471
View Source
const VARIABLE = 57353
View Source
const VIEW = 57384
View Source
const WHEN = 57430
View Source
const WHERE = 57364
View Source
const WHILE = 57429
View Source
const WITH = 57419
View Source
const WITHIN = 57470

Variables

This section is empty.

Functions

func FormatFieldIdentifier added in v0.7.9

func FormatFieldIdentifier(e QueryExpression) string

func FormatTableName added in v0.1.6

func FormatTableName(s string) string

func NewSyntaxError added in v0.4.3

func NewSyntaxError(message string, token Token) error

func SetDebugLevel

func SetDebugLevel(level int, verbose bool)

func TokenLiteral

func TokenLiteral(token int) string

Types

type AddColumns added in v0.1.6

type AddColumns struct {
	*BaseExpr
	Table    QueryExpression
	Columns  []ColumnDefault
	Position Expression
}

type AddFlagElement added in v1.6.5

type AddFlagElement struct {
	*BaseExpr
	Name  string
	Value QueryExpression
}

type AggregateDeclaration added in v0.4.10

type AggregateDeclaration struct {
	*BaseExpr
	Name       Identifier
	Cursor     Identifier
	Parameters []VariableAssignment
	Statements []Statement
}

type AggregateFunction added in v0.4.0

type AggregateFunction struct {
	*BaseExpr
	Name     string
	Distinct Token
	Args     []QueryExpression
}

func (AggregateFunction) IsDistinct added in v0.4.9

func (e AggregateFunction) IsDistinct() bool

func (AggregateFunction) String added in v0.4.0

func (e AggregateFunction) String() string

type All

type All struct {
	*BaseExpr
	All      string
	LHS      QueryExpression
	Operator string
	Values   QueryExpression
}

func (All) String

func (a All) String() string

type AllColumns

type AllColumns struct {
	*BaseExpr
}

func (AllColumns) String

func (ac AllColumns) String() string

type AnalyticClause added in v0.2.3

type AnalyticClause struct {
	*BaseExpr
	PartitionClause QueryExpression
	OrderByClause   QueryExpression
	WindowingClause QueryExpression
}

func (AnalyticClause) PartitionValues added in v0.2.3

func (e AnalyticClause) PartitionValues() []QueryExpression

func (AnalyticClause) String added in v0.2.3

func (e AnalyticClause) String() string

type AnalyticFunction added in v0.2.3

type AnalyticFunction struct {
	*BaseExpr
	Name           string
	Distinct       Token
	Args           []QueryExpression
	IgnoreNulls    bool
	IgnoreNullsLit string
	Over           string
	AnalyticClause AnalyticClause
}

func (AnalyticFunction) IsDistinct added in v0.4.9

func (e AnalyticFunction) IsDistinct() bool

func (AnalyticFunction) String added in v0.2.3

func (e AnalyticFunction) String() string

type Any

type Any struct {
	*BaseExpr
	Any      string
	LHS      QueryExpression
	Operator string
	Values   QueryExpression
}

func (Any) String

func (a Any) String() string

type Arithmetic

type Arithmetic struct {
	*BaseExpr
	LHS      QueryExpression
	Operator int
	RHS      QueryExpression
}

func (Arithmetic) String

func (a Arithmetic) String() string

type BaseExpr added in v0.4.3

type BaseExpr struct {
	// contains filtered or unexported fields
}

func NewBaseExpr added in v0.4.3

func NewBaseExpr(token Token) *BaseExpr

func (*BaseExpr) Char added in v0.4.3

func (e *BaseExpr) Char() int

func (*BaseExpr) GetBaseExpr added in v0.4.3

func (e *BaseExpr) GetBaseExpr() *BaseExpr

func (*BaseExpr) HasParseInfo added in v0.4.3

func (e *BaseExpr) HasParseInfo() bool

func (*BaseExpr) Line added in v0.4.3

func (e *BaseExpr) Line() int

func (*BaseExpr) SourceFile added in v0.4.3

func (e *BaseExpr) SourceFile() string

type Between

type Between struct {
	*BaseExpr
	Between  string
	And      string
	LHS      QueryExpression
	Low      QueryExpression
	High     QueryExpression
	Negation Token
}

func (Between) IsNegated

func (b Between) IsNegated() bool

func (Between) String

func (b Between) String() string

type Case

type Case struct {
	*BaseExpr
	Value QueryExpression
	When  []CaseWhen
	Else  CaseElse
}

type CaseElse

type CaseElse struct {
	*BaseExpr
	Statements []Statement
}

type CaseExpr added in v0.7.3

type CaseExpr struct {
	*BaseExpr
	Case  string
	End   string
	Value QueryExpression
	When  []QueryExpression
	Else  QueryExpression
}

func (CaseExpr) String added in v0.7.3

func (e CaseExpr) String() string

type CaseExprElse added in v0.7.3

type CaseExprElse struct {
	*BaseExpr
	Else   string
	Result QueryExpression
}

func (CaseExprElse) String added in v0.7.3

func (e CaseExprElse) String() string

type CaseExprWhen added in v0.7.3

type CaseExprWhen struct {
	*BaseExpr
	When      string
	Then      string
	Condition QueryExpression
	Result    QueryExpression
}

func (CaseExprWhen) String added in v0.7.3

func (e CaseExprWhen) String() string

type CaseWhen

type CaseWhen struct {
	*BaseExpr
	Condition  QueryExpression
	Statements []Statement
}

type Chdir added in v1.6.2

type Chdir struct {
	*BaseExpr
	DirPath QueryExpression
}

type CloseCursor added in v0.1.8

type CloseCursor struct {
	*BaseExpr
	Cursor Identifier
}

type ColumnDefault added in v0.1.6

type ColumnDefault struct {
	*BaseExpr
	Column Identifier
	Value  QueryExpression
}

type ColumnNumber added in v0.4.6

type ColumnNumber struct {
	*BaseExpr
	View   Identifier
	Number value.Integer
}

func (ColumnNumber) String added in v0.4.6

func (e ColumnNumber) String() string

type ColumnPosition added in v0.1.6

type ColumnPosition struct {
	*BaseExpr
	Position Token
	Column   QueryExpression
}

type Comparison

type Comparison struct {
	*BaseExpr
	LHS      QueryExpression
	Operator string
	RHS      QueryExpression
}

func (Comparison) String

func (c Comparison) String() string

type Concat

type Concat struct {
	*BaseExpr
	Items []QueryExpression
}

func (Concat) String

func (c Concat) String() string

type CreateTable added in v0.1.6

type CreateTable struct {
	*BaseExpr
	Table  Identifier
	Fields []QueryExpression
	Query  QueryExpression
}

type CursorAttrebute added in v0.4.10

type CursorAttrebute struct {
	*BaseExpr
	CursorLit string
	Cursor    Identifier
	Attrebute Token
}

func (CursorAttrebute) String added in v0.4.10

func (e CursorAttrebute) String() string

type CursorDeclaration added in v0.1.8

type CursorDeclaration struct {
	*BaseExpr
	Cursor Identifier
	Query  SelectQuery
}

type CursorStatus added in v0.2.5

type CursorStatus struct {
	*BaseExpr
	CursorLit string
	Cursor    Identifier
	Is        string
	Negation  Token
	Type      int
	TypeLit   string
}

func (CursorStatus) String added in v0.2.5

func (e CursorStatus) String() string

type DeleteQuery added in v0.1.6

type DeleteQuery struct {
	*BaseExpr
	WithClause  QueryExpression
	Tables      []QueryExpression
	FromClause  FromClause
	WhereClause QueryExpression
}

type DisposeCursor added in v0.1.8

type DisposeCursor struct {
	*BaseExpr
	Cursor Identifier
}

type DisposeFunction added in v1.0.1

type DisposeFunction struct {
	*BaseExpr
	Name Identifier
}

type DisposeVariable added in v0.4.4

type DisposeVariable struct {
	*BaseExpr
	Variable Variable
}

type DisposeView added in v0.8.6

type DisposeView struct {
	*BaseExpr
	View Identifier
}

type DropColumns added in v0.1.6

type DropColumns struct {
	*BaseExpr
	Table   QueryExpression
	Columns []QueryExpression
}

type Dual

type Dual struct {
	*BaseExpr
	Dual string
}

func (Dual) String

func (d Dual) String() string

type Echo added in v1.6.2

type Echo struct {
	*BaseExpr
	Value QueryExpression
}

type Else added in v0.1.8

type Else struct {
	*BaseExpr
	Statements []Statement
}

type ElseIf added in v0.1.8

type ElseIf struct {
	*BaseExpr
	Condition  QueryExpression
	Statements []Statement
}

type EnvironmentVariable added in v1.6.2

type EnvironmentVariable struct {
	*BaseExpr
	Name   string
	Quoted bool
}

func (EnvironmentVariable) String added in v1.6.2

func (e EnvironmentVariable) String() string

type Execute added in v1.5.3

type Execute struct {
	*BaseExpr
	Statements QueryExpression
	Values     []QueryExpression
}

type Exists

type Exists struct {
	*BaseExpr
	Exists string
	Query  Subquery
}

func (Exists) String

func (e Exists) String() string

type Exit added in v0.7.5

type Exit struct {
	*BaseExpr
	Code value.Primary
}

type Expression

type Expression interface {
	GetBaseExpr() *BaseExpr
	HasParseInfo() bool
	Line() int
	Char() int
	SourceFile() string
}

type ExternalCommand added in v1.6.2

type ExternalCommand struct {
	*BaseExpr
	Command string
}

type FetchCursor added in v0.1.8

type FetchCursor struct {
	*BaseExpr
	Position  FetchPosition
	Cursor    Identifier
	Variables []Variable
}

type FetchPosition added in v0.2.5

type FetchPosition struct {
	*BaseExpr
	Position Token
	Number   QueryExpression
}

type Field

type Field struct {
	*BaseExpr
	Object QueryExpression
	As     string
	Alias  QueryExpression
}

func (Field) Name

func (f Field) Name() string

func (Field) String

func (f Field) String() string

type FieldReference added in v0.1.8

type FieldReference struct {
	*BaseExpr
	View   Identifier
	Column Identifier
}

func (FieldReference) String added in v0.1.8

func (e FieldReference) String() string

type FlowControl added in v0.1.8

type FlowControl struct {
	*BaseExpr
	Token int
}

type FromClause

type FromClause struct {
	*BaseExpr
	From   string
	Tables []QueryExpression
}

func (FromClause) String

func (f FromClause) String() string

type Function

type Function struct {
	*BaseExpr
	Name string
	Args []QueryExpression
}

func (Function) String

func (e Function) String() string

type FunctionDeclaration added in v0.4.0

type FunctionDeclaration struct {
	*BaseExpr
	Name       Identifier
	Parameters []VariableAssignment
	Statements []Statement
}

type GroupByClause

type GroupByClause struct {
	*BaseExpr
	GroupBy string
	Items   []QueryExpression
}

func (GroupByClause) String

func (gb GroupByClause) String() string

type HavingClause

type HavingClause struct {
	*BaseExpr
	Having string
	Filter QueryExpression
}

func (HavingClause) String

func (h HavingClause) String() string

type Identifier

type Identifier struct {
	*BaseExpr
	Literal string
	Quoted  bool
}

func (Identifier) String

func (i Identifier) String() string

type If added in v0.1.8

type If struct {
	*BaseExpr
	Condition  QueryExpression
	Statements []Statement
	ElseIf     []ElseIf
	Else       Else
}

type In

type In struct {
	*BaseExpr
	In       string
	LHS      QueryExpression
	Values   QueryExpression
	Negation Token
}

func (In) IsNegated

func (i In) IsNegated() bool

func (In) String

func (i In) String() string

type InlineTable added in v0.3.5

type InlineTable struct {
	*BaseExpr
	Recursive Token
	Name      Identifier
	Fields    []QueryExpression
	As        string
	Query     SelectQuery
}

func (InlineTable) IsRecursive added in v0.3.5

func (e InlineTable) IsRecursive() bool

func (InlineTable) String added in v0.3.5

func (e InlineTable) String() string

type InsertQuery added in v0.1.6

type InsertQuery struct {
	*BaseExpr
	WithClause QueryExpression
	Table      Table
	Fields     []QueryExpression
	ValuesList []QueryExpression
	Query      QueryExpression
}

type Is

type Is struct {
	*BaseExpr
	Is       string
	LHS      QueryExpression
	RHS      QueryExpression
	Negation Token
}

func (Is) IsNegated

func (i Is) IsNegated() bool

func (Is) String

func (i Is) String() string

type Join

type Join struct {
	*BaseExpr
	Join      string
	Table     QueryExpression
	JoinTable QueryExpression
	Natural   Token
	JoinType  Token
	Direction Token
	Condition QueryExpression
}

func (Join) String

func (j Join) String() string

type JoinCondition

type JoinCondition struct {
	*BaseExpr
	Literal string
	On      QueryExpression
	Using   []QueryExpression
}

func (JoinCondition) String

func (jc JoinCondition) String() string

type JsonQuery added in v1.3.0

type JsonQuery struct {
	*BaseExpr
	JsonQuery string
	Query     QueryExpression
	JsonText  QueryExpression
}

func (JsonQuery) String added in v1.3.0

func (e JsonQuery) String() string

type Lexer

type Lexer struct {
	Scanner
	// contains filtered or unexported fields
}

func (*Lexer) Error

func (l *Lexer) Error(e string)

func (*Lexer) Lex

func (l *Lexer) Lex(lval *yySymType) int

type Like

type Like struct {
	*BaseExpr
	Like     string
	LHS      QueryExpression
	Pattern  QueryExpression
	Negation Token
}

func (Like) IsNegated

func (l Like) IsNegated() bool

func (Like) String

func (l Like) String() string

type LimitClause

type LimitClause struct {
	*BaseExpr
	Limit   string
	Value   QueryExpression
	Percent string
	With    QueryExpression
}

func (LimitClause) IsPercentage added in v0.2.3

func (e LimitClause) IsPercentage() bool

func (LimitClause) IsWithTies added in v0.2.3

func (e LimitClause) IsWithTies() bool

func (LimitClause) String

func (e LimitClause) String() string

type LimitWith added in v0.2.3

type LimitWith struct {
	*BaseExpr
	With string
	Type Token
}

func (LimitWith) String added in v0.2.3

func (e LimitWith) String() string

type ListFunction added in v1.5.0

type ListFunction struct {
	*BaseExpr
	Name        string
	Distinct    Token
	Args        []QueryExpression
	WithinGroup string
	OrderBy     QueryExpression
}

func (ListFunction) IsDistinct added in v1.5.0

func (e ListFunction) IsDistinct() bool

func (ListFunction) String added in v1.5.0

func (e ListFunction) String() string

type Logic

type Logic struct {
	*BaseExpr
	LHS      QueryExpression
	Operator Token
	RHS      QueryExpression
}

func (Logic) String

func (l Logic) String() string

type OffsetClause added in v0.2.2

type OffsetClause struct {
	*BaseExpr
	Offset string
	Value  QueryExpression
}

func (OffsetClause) String added in v0.2.2

func (e OffsetClause) String() string

type OpenCursor added in v0.1.8

type OpenCursor struct {
	*BaseExpr
	Cursor Identifier
}

type OrderByClause

type OrderByClause struct {
	*BaseExpr
	OrderBy string
	Items   []QueryExpression
}

func (OrderByClause) String

func (ob OrderByClause) String() string

type OrderItem

type OrderItem struct {
	*BaseExpr
	Value     QueryExpression
	Direction Token
	Nulls     string
	Position  Token
}

func (OrderItem) String

func (e OrderItem) String() string

type Parentheses

type Parentheses struct {
	*BaseExpr
	Expr QueryExpression
}

func (Parentheses) String

func (p Parentheses) String() string

type PartitionClause added in v1.0.1

type PartitionClause struct {
	*BaseExpr
	PartitionBy string
	Values      []QueryExpression
}

func (PartitionClause) String added in v1.0.1

func (e PartitionClause) String() string

type PrimitiveType added in v0.6.6

type PrimitiveType struct {
	*BaseExpr
	Literal string
	Value   value.Primary
}

func NewDatetimeValue added in v0.6.6

func NewDatetimeValue(t time.Time) PrimitiveType

func NewDatetimeValueFromString added in v0.6.6

func NewDatetimeValueFromString(s string) PrimitiveType

func NewFloatValue added in v0.6.6

func NewFloatValue(f float64) PrimitiveType

func NewFloatValueFromString added in v0.7.0

func NewFloatValueFromString(s string) PrimitiveType

func NewIntegerValue added in v0.6.6

func NewIntegerValue(i int64) PrimitiveType

func NewIntegerValueFromString added in v0.7.0

func NewIntegerValueFromString(s string) PrimitiveType

func NewNullValue added in v0.6.6

func NewNullValue() PrimitiveType

func NewNullValueFromString added in v0.6.6

func NewNullValueFromString(s string) PrimitiveType

func NewStringValue added in v0.6.6

func NewStringValue(s string) PrimitiveType

func NewTernaryValue added in v0.6.6

func NewTernaryValue(t ternary.Value) PrimitiveType

func NewTernaryValueFromString added in v0.6.6

func NewTernaryValueFromString(s string) PrimitiveType

func (PrimitiveType) IsInteger added in v0.6.6

func (e PrimitiveType) IsInteger() bool

func (PrimitiveType) String added in v0.6.6

func (e PrimitiveType) String() string

type Print added in v0.1.6

type Print struct {
	*BaseExpr
	Value QueryExpression
}

type Printf added in v0.4.0

type Printf struct {
	*BaseExpr
	Format QueryExpression
	Values []QueryExpression
}

type Pwd added in v1.6.2

type Pwd struct {
	*BaseExpr
}

type QueryExpression added in v0.7.4

type QueryExpression interface {
	String() string

	GetBaseExpr() *BaseExpr
	HasParseInfo() bool
	Line() int
	Char() int
	SourceFile() string
}

type Reload added in v1.6.2

type Reload struct {
	*BaseExpr
	Type Identifier
}

type RemoveFlagElement added in v1.6.5

type RemoveFlagElement struct {
	*BaseExpr
	Name  string
	Value QueryExpression
}

type RenameColumn added in v0.1.6

type RenameColumn struct {
	*BaseExpr
	Table QueryExpression
	Old   QueryExpression
	New   Identifier
}

type Return added in v0.4.0

type Return struct {
	*BaseExpr
	Value QueryExpression
}

type RowValue added in v0.2.2

type RowValue struct {
	*BaseExpr
	Value QueryExpression
}

func (RowValue) String added in v0.2.2

func (e RowValue) String() string

type RowValueList added in v0.2.2

type RowValueList struct {
	*BaseExpr
	RowValues []QueryExpression
}

func (RowValueList) String added in v0.2.2

func (e RowValueList) String() string

type RuntimeInformation added in v1.6.2

type RuntimeInformation struct {
	*BaseExpr
	Name string
}

func (RuntimeInformation) String added in v1.6.2

func (e RuntimeInformation) String() string

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func (*Scanner) Init

func (s *Scanner) Init(src string, sourceFile string) *Scanner

func (*Scanner) Scan

func (s *Scanner) Scan() (Token, error)

type SelectClause

type SelectClause struct {
	*BaseExpr
	Select   string
	Distinct Token
	Fields   []QueryExpression
}

func (SelectClause) IsDistinct

func (sc SelectClause) IsDistinct() bool

func (SelectClause) String

func (sc SelectClause) String() string

type SelectEntity added in v0.2.1

type SelectEntity struct {
	*BaseExpr
	SelectClause  QueryExpression
	FromClause    QueryExpression
	WhereClause   QueryExpression
	GroupByClause QueryExpression
	HavingClause  QueryExpression
}

func (SelectEntity) String added in v0.2.1

func (e SelectEntity) String() string

type SelectQuery

type SelectQuery struct {
	*BaseExpr
	WithClause    QueryExpression
	SelectEntity  QueryExpression
	OrderByClause QueryExpression
	LimitClause   QueryExpression
	OffsetClause  QueryExpression
}

func (SelectQuery) String

func (e SelectQuery) String() string

type SelectSet added in v0.2.1

type SelectSet struct {
	*BaseExpr
	LHS      QueryExpression
	Operator Token
	All      Token
	RHS      QueryExpression
}

func (SelectSet) String added in v0.2.1

func (e SelectSet) String() string

type SetEnvVar added in v1.6.0

type SetEnvVar struct {
	*BaseExpr
	EnvVar EnvironmentVariable
	Value  QueryExpression
}

type SetFlag added in v0.1.6

type SetFlag struct {
	*BaseExpr
	Name  string
	Value QueryExpression
}

type SetTableAttribute added in v1.5.0

type SetTableAttribute struct {
	*BaseExpr
	Table     QueryExpression
	Attribute Identifier
	Value     QueryExpression
}

type ShowFields added in v0.8.6

type ShowFields struct {
	*BaseExpr
	Type  Identifier
	Table QueryExpression
}

type ShowFlag added in v0.8.0

type ShowFlag struct {
	*BaseExpr
	Name string
}

type ShowObjects added in v0.8.6

type ShowObjects struct {
	*BaseExpr
	Type Identifier
}

type Source added in v0.4.0

type Source struct {
	*BaseExpr
	FilePath QueryExpression
}

type Statement

type Statement interface{}

func Parse

func Parse(s string, sourceFile string) ([]Statement, error)

type Stdin added in v0.1.5

type Stdin struct {
	*BaseExpr
	Stdin string
}

func (Stdin) String added in v0.1.5

func (si Stdin) String() string

type Subquery

type Subquery struct {
	*BaseExpr
	Query SelectQuery
}

func (Subquery) String

func (sq Subquery) String() string

type Syntax added in v1.7.2

type Syntax struct {
	*BaseExpr
	Keywords []QueryExpression
}

type SyntaxError added in v0.4.3

type SyntaxError struct {
	SourceFile string
	Line       int
	Char       int
	Message    string
}

func (SyntaxError) Error added in v0.4.3

func (e SyntaxError) Error() string

type Table

type Table struct {
	*BaseExpr
	Object QueryExpression
	As     string
	Alias  QueryExpression
}

func (Table) Name

func (t Table) Name() Identifier

func (Table) String

func (t Table) String() string

type TableObject added in v1.5.0

type TableObject struct {
	*BaseExpr
	Type          Identifier
	FormatElement QueryExpression
	Path          Identifier
	Args          []QueryExpression
}

func (TableObject) String added in v1.5.0

func (e TableObject) String() string

type Token

type Token struct {
	Token      int
	Literal    string
	Quoted     bool
	Line       int
	Char       int
	SourceFile string
}

func (*Token) IsEmpty

func (t *Token) IsEmpty() bool

type TransactionControl added in v0.1.8

type TransactionControl struct {
	*BaseExpr
	Token int
}

type Trigger added in v0.5.0

type Trigger struct {
	*BaseExpr
	Event   Identifier
	Message QueryExpression
	Code    value.Primary
}

type UnaryArithmetic added in v0.4.3

type UnaryArithmetic struct {
	*BaseExpr
	Operand  QueryExpression
	Operator Token
}

func (UnaryArithmetic) String added in v0.4.3

func (e UnaryArithmetic) String() string

type UnaryLogic added in v0.4.3

type UnaryLogic struct {
	*BaseExpr
	Operand  QueryExpression
	Operator Token
}

func (UnaryLogic) String added in v0.4.3

func (e UnaryLogic) String() string

type UnsetEnvVar added in v1.6.0

type UnsetEnvVar struct {
	*BaseExpr
	EnvVar EnvironmentVariable
}

type UpdateQuery added in v0.1.6

type UpdateQuery struct {
	*BaseExpr
	WithClause  QueryExpression
	Tables      []QueryExpression
	SetList     []UpdateSet
	FromClause  QueryExpression
	WhereClause QueryExpression
}

type UpdateSet added in v0.1.6

type UpdateSet struct {
	*BaseExpr
	Field QueryExpression
	Value QueryExpression
}

type ValueList added in v0.2.2

type ValueList struct {
	*BaseExpr
	Values []QueryExpression
}

func (ValueList) String added in v0.2.2

func (e ValueList) String() string

type Variable

type Variable struct {
	*BaseExpr
	Name string
}

func (Variable) String

func (v Variable) String() string

type VariableAssignment

type VariableAssignment struct {
	*BaseExpr
	Variable Variable
	Value    QueryExpression
}

type VariableDeclaration

type VariableDeclaration struct {
	*BaseExpr
	Assignments []VariableAssignment
}

type VariableSubstitution

type VariableSubstitution struct {
	*BaseExpr
	Variable Variable
	Value    QueryExpression
}

func (VariableSubstitution) String

func (vs VariableSubstitution) String() string

type ViewDeclaration added in v0.8.6

type ViewDeclaration struct {
	*BaseExpr
	View   Identifier
	Fields []QueryExpression
	Query  QueryExpression
}

type WhereClause

type WhereClause struct {
	*BaseExpr
	Where  string
	Filter QueryExpression
}

func (WhereClause) String

func (w WhereClause) String() string

type While added in v0.1.8

type While struct {
	*BaseExpr
	Condition  QueryExpression
	Statements []Statement
}

type WhileInCursor added in v0.1.8

type WhileInCursor struct {
	*BaseExpr
	WithDeclaration bool
	Variables       []Variable
	Cursor          Identifier
	Statements      []Statement
}

type WindowFramePosition added in v1.0.1

type WindowFramePosition struct {
	*BaseExpr
	Direction int
	Unbounded bool
	Offset    int
	Literal   string
}

func (WindowFramePosition) String added in v1.0.1

func (e WindowFramePosition) String() string

type WindowingClause added in v1.0.1

type WindowingClause struct {
	*BaseExpr
	Rows      string
	FrameLow  QueryExpression
	FrameHigh QueryExpression
	Between   string
	And       string
}

func (WindowingClause) String added in v1.0.1

func (e WindowingClause) String() string

type WithClause added in v0.3.5

type WithClause struct {
	*BaseExpr
	With         string
	InlineTables []QueryExpression
}

func (WithClause) String added in v0.3.5

func (e WithClause) String() string

Jump to

Keyboard shortcuts

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