Documentation ¶
Index ¶
- Constants
- func Float64ToStr(f float64) string
- func Int64ToStr(i int64) string
- func IsNull(v Primary) bool
- func IsPrimary(e Expression) bool
- func SetDebugLevel(level int, verbose bool)
- func StrToTime(s string) (time.Time, error)
- func TokenLiteral(token int) string
- type All
- type AllColumns
- type Any
- type Arithmetic
- type Between
- type Boolean
- type Case
- type CaseElse
- type CaseWhen
- type Comparison
- type Concat
- type Datetime
- type Dual
- type Exists
- type Expression
- type Field
- type Float
- type FromClause
- type Function
- type GroupByClause
- type GroupConcat
- type HavingClause
- type Identifier
- type In
- type Integer
- type Is
- type Join
- type JoinCondition
- type Lexer
- type Like
- type LimitClause
- type Logic
- type Null
- type Option
- type OrderByClause
- type OrderItem
- type Parentheses
- type Primary
- type Scanner
- type SelectClause
- type SelectQuery
- type Statement
- type Stdin
- type String
- type Subquery
- type Table
- type Ternary
- type Token
- type Variable
- type VariableAssignment
- type VariableDeclaration
- type VariableSubstitution
- type WhereClause
Examples ¶
Constants ¶
View Source
const ( EOF = -(iota + 1) UNCATEGORIZED )
View Source
const ALL = 57389
View Source
const ALTER = 57368
View Source
const AND = 57393
View Source
const ANY = 57390
View Source
const AS = 57363
View Source
const ASC = 57375
View Source
const BETWEEN = 57396
View Source
const BOOLEAN = 57350
View Source
const BY = 57374
View Source
const CASE = 57405
View Source
const COLUMN = 57370
View Source
const COMPARISON_OP = 57413
View Source
const CREATE = 57366
View Source
const CROSS = 57384
View Source
const DATETIME = 57352
View Source
const DATETIME_FORMAT = "2006-01-02 15:04:05.999999999"
View Source
const DELETE = 57358
View Source
const DESC = 57376
View Source
const DISTINCT = 57400
View Source
const DROP = 57367
View Source
const DUAL = 57364
View Source
const ELSE = 57408
View Source
const END = 57409
View Source
const EXISTS = 57391
View Source
const FALSE = 57403
View Source
const FLOAT = 57349
View Source
const FROM = 57355
View Source
const FULL = 57383
View Source
const GROUP = 57372
View Source
const GROUP_CONCAT = 57410
View Source
const HAVING = 57373
View Source
const IDENTIFIER = 57346
View Source
const IN = 57392
View Source
const INNER = 57379
View Source
const INSERT = 57360
View Source
const INTEGER = 57348
View Source
const INTO = 57361
View Source
const IS = 57398
View Source
const JOIN = 57378
View Source
const LEFT = 57381
View Source
const LIKE = 57397
View Source
const LIMIT = 57377
View Source
const NATURAL = 57387
View Source
const NOT = 57395
View Source
const NULL = 57399
View Source
const ON = 57385
View Source
const OR = 57394
View Source
const ORDER = 57371
View Source
const OUTER = 57380
View Source
const RIGHT = 57382
View Source
const SELECT = 57354
View Source
const SEPARATOR = 57411
View Source
const SET = 57357
View Source
const STDIN = 57365
View Source
const STRING = 57347
View Source
const STRING_OP = 57414
View Source
const SUBSTITUTION_OP = 57415
View Source
const TABLE = 57369
View Source
const TERNARY = 57351
View Source
const THEN = 57407
View Source
const TOKEN_UNDEFINED = 0
View Source
const TRUE = 57402
View Source
const UNION = 57388
View Source
const UNKNOWN = 57404
View Source
const UPDATE = 57356
View Source
const USING = 57386
View Source
const VALUES = 57362
View Source
const VAR = 57412
View Source
const VARIABLE = 57353
View Source
const WHEN = 57406
View Source
const WHERE = 57359
View Source
const WITH = 57401
Variables ¶
This section is empty.
Functions ¶
func Float64ToStr ¶
func Int64ToStr ¶
func IsPrimary ¶
func IsPrimary(e Expression) bool
func SetDebugLevel ¶
Example ¶
SetDebugLevel(0, false) _, err := Parse("select select") fmt.Println(err) SetDebugLevel(0, true) _, err = Parse("select select") fmt.Println(err)
Output: syntax error syntax error: unexpected SELECT
func TokenLiteral ¶
Types ¶
type AllColumns ¶
type AllColumns struct { }
func (AllColumns) String ¶
func (ac AllColumns) String() string
type Arithmetic ¶
type Arithmetic struct { LHS Expression Operator int RHS Expression }
func (Arithmetic) String ¶
func (a Arithmetic) String() string
type Between ¶
type Between struct { Between string And string LHS Expression Low Expression High Expression Negation Token }
type Case ¶
type Case struct { Case string End string Value Expression When []Expression Else Expression }
type CaseElse ¶
type CaseElse struct { Else string Result Expression }
type CaseWhen ¶
type CaseWhen struct { When string Then string Condition Expression Result Expression }
type Comparison ¶
type Comparison struct { LHS Expression Operator Token RHS Expression }
func (Comparison) String ¶
func (c Comparison) String() string
type Concat ¶
type Concat struct {
Items []Expression
}
type Datetime ¶
type Datetime struct {
// contains filtered or unexported fields
}
func NewDatetime ¶
func NewDatetimeFromString ¶
type Expression ¶
type Expression interface {
String() string
}
type Field ¶
type Field struct { Object Expression As Token Alias Expression }
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
func NewFloatFromString ¶
type FromClause ¶
type FromClause struct { From string Tables []Expression }
func (FromClause) String ¶
func (f FromClause) String() string
type GroupByClause ¶
type GroupByClause struct { GroupBy string Items []Expression }
func (GroupByClause) String ¶
func (gb GroupByClause) String() string
type GroupConcat ¶
type GroupConcat struct { GroupConcat string Option Option OrderBy Expression SeparatorLit string Separator string }
func (GroupConcat) String ¶
func (gc GroupConcat) String() string
type HavingClause ¶
type HavingClause struct { Having string Filter Expression }
func (HavingClause) String ¶
func (h HavingClause) String() string
type Identifier ¶
func (Identifier) String ¶
func (i Identifier) String() string
type In ¶
type In struct { In string LHS Expression List []Expression Query Subquery Negation Token }
type Integer ¶
type Integer struct {
// contains filtered or unexported fields
}
func NewInteger ¶
func NewIntegerFromString ¶
type Is ¶
type Is struct { Is string LHS Expression RHS Expression Negation Token }
type Join ¶
type JoinCondition ¶
type JoinCondition struct { Literal string On Expression Using []Expression }
func (JoinCondition) String ¶
func (jc JoinCondition) String() string
type Like ¶
type Like struct { Like string LHS Expression Pattern Expression Negation Token }
type LimitClause ¶
func (LimitClause) String ¶
func (l LimitClause) String() string
type Logic ¶
type Logic struct { LHS Expression Operator Token RHS Expression }
type OrderByClause ¶
type OrderByClause struct { OrderBy string Items []Expression }
func (OrderByClause) String ¶
func (ob OrderByClause) String() string
type OrderItem ¶
type OrderItem struct { Item Expression Direction Token }
type Parentheses ¶
type Parentheses struct {
Expr Expression
}
func (Parentheses) String ¶
func (p Parentheses) String() string
type Primary ¶
func Float64ToPrimary ¶
func PrimaryToBoolean ¶
func PrimaryToDatetime ¶
func PrimaryToFloat ¶
func PrimaryToInteger ¶
func PrimaryToString ¶
type SelectClause ¶
type SelectClause struct { Select string Distinct Token Fields []Expression }
func (SelectClause) IsDistinct ¶
func (sc SelectClause) IsDistinct() bool
func (SelectClause) String ¶
func (sc SelectClause) String() string
type SelectQuery ¶
type SelectQuery struct { SelectClause Expression FromClause Expression WhereClause Expression GroupByClause Expression HavingClause Expression OrderByClause Expression LimitClause Expression }
func (SelectQuery) String ¶
func (sq SelectQuery) String() string
type Subquery ¶
type Subquery struct {
Query SelectQuery
}
type Table ¶
type Table struct { Object Expression As Token Alias Expression }
type Ternary ¶
type Ternary struct {
// contains filtered or unexported fields
}
func NewTernary ¶
func NewTernaryFromString ¶
type VariableAssignment ¶
type VariableAssignment struct { Name string Value Expression }
func (VariableAssignment) String ¶
func (va VariableAssignment) String() string
type VariableDeclaration ¶
type VariableDeclaration struct { Var string Assignments []Expression }
func (VariableDeclaration) String ¶
func (vd VariableDeclaration) String() string
type VariableSubstitution ¶
type VariableSubstitution struct { Variable Variable Value Expression }
func (VariableSubstitution) String ¶
func (vs VariableSubstitution) String() string
type WhereClause ¶
type WhereClause struct { Where string Filter Expression }
func (WhereClause) String ¶
func (w WhereClause) String() string
Click to show internal directories.
Click to hide internal directories.