Documentation ¶
Index ¶
- Constants
- func ContainsVars(expr Expr) bool
- func FillArgs(stmt Statement, args Args) error
- func SimilarEscape(pattern string) string
- func WalkStmt(v Visitor, stmt Statement)
- type AliasedTableExpr
- type AlterTable
- type AlterTableAddColumn
- type AlterTableAddConstraint
- type AlterTableCmd
- type AlterTableCmds
- type AlterTableDropColumn
- type AlterTableDropConstraint
- type AndExpr
- type Args
- type Array
- type ArrayIndirection
- type BeginTransaction
- type BinaryExpr
- type BinaryOp
- type BoolType
- type BytesType
- type CaseExpr
- type CastExpr
- type CoalesceExpr
- type ColumnDefault
- type ColumnQualification
- type ColumnTableDef
- type ColumnType
- type CommitTransaction
- type ComparisonExpr
- type ComparisonOp
- type ConstraintTableDef
- type CreateDatabase
- type CreateIndex
- type CreateTable
- type DBool
- func (d DBool) Compare(other Datum) int
- func (t DBool) Eval(_ EvalContext) (Datum, error)
- func (d DBool) HasNext() bool
- func (d DBool) HasPrev() bool
- func (d DBool) IsMax() bool
- func (d DBool) IsMin() bool
- func (d DBool) Next() Datum
- func (d DBool) Prev() Datum
- func (d DBool) String() string
- func (d DBool) Type() string
- func (expr DBool) TypeCheck(args MapArgs) (Datum, error)
- func (DBool) Walk(_ Visitor)
- type DBytes
- func (d DBytes) Compare(other Datum) int
- func (t DBytes) Eval(_ EvalContext) (Datum, error)
- func (d DBytes) HasNext() bool
- func (d DBytes) HasPrev() bool
- func (d DBytes) IsMax() bool
- func (d DBytes) IsMin() bool
- func (d DBytes) Next() Datum
- func (d DBytes) Prev() Datum
- func (d DBytes) String() string
- func (d DBytes) Type() string
- func (expr DBytes) TypeCheck(args MapArgs) (Datum, error)
- func (DBytes) Walk(_ Visitor)
- type DDate
- func (d DDate) Compare(other Datum) int
- func (t DDate) Eval(_ EvalContext) (Datum, error)
- func (d DDate) HasNext() bool
- func (d DDate) HasPrev() bool
- func (d DDate) IsMax() bool
- func (d DDate) IsMin() bool
- func (d DDate) Next() Datum
- func (d DDate) Prev() Datum
- func (d DDate) String() string
- func (d DDate) Type() string
- func (expr DDate) TypeCheck(args MapArgs) (Datum, error)
- func (DDate) Walk(_ Visitor)
- type DDecimal
- func (d DDecimal) Compare(other Datum) int
- func (t DDecimal) Eval(_ EvalContext) (Datum, error)
- func (d DDecimal) HasNext() bool
- func (d DDecimal) HasPrev() bool
- func (d DDecimal) IsMax() bool
- func (d DDecimal) IsMin() bool
- func (d DDecimal) Next() Datum
- func (d DDecimal) Prev() Datum
- func (d DDecimal) String() string
- func (d DDecimal) Type() string
- func (expr DDecimal) TypeCheck(args MapArgs) (Datum, error)
- func (DDecimal) Walk(_ Visitor)
- type DFloat
- func (d DFloat) Compare(other Datum) int
- func (t DFloat) Eval(_ EvalContext) (Datum, error)
- func (d DFloat) HasNext() bool
- func (d DFloat) HasPrev() bool
- func (d DFloat) IsMax() bool
- func (d DFloat) IsMin() bool
- func (d DFloat) Next() Datum
- func (d DFloat) Prev() Datum
- func (d DFloat) String() string
- func (d DFloat) Type() string
- func (expr DFloat) TypeCheck(args MapArgs) (Datum, error)
- func (DFloat) Walk(_ Visitor)
- type DInt
- func (d DInt) Compare(other Datum) int
- func (t DInt) Eval(_ EvalContext) (Datum, error)
- func (d DInt) HasNext() bool
- func (d DInt) HasPrev() bool
- func (d DInt) IsMax() bool
- func (d DInt) IsMin() bool
- func (d DInt) Next() Datum
- func (d DInt) Prev() Datum
- func (d DInt) String() string
- func (d DInt) Type() string
- func (expr DInt) TypeCheck(args MapArgs) (Datum, error)
- func (DInt) Walk(_ Visitor)
- type DInterval
- func (d DInterval) Compare(other Datum) int
- func (t DInterval) Eval(_ EvalContext) (Datum, error)
- func (d DInterval) HasNext() bool
- func (d DInterval) HasPrev() bool
- func (d DInterval) IsMax() bool
- func (d DInterval) IsMin() bool
- func (d DInterval) Next() Datum
- func (d DInterval) Prev() Datum
- func (d DInterval) Type() string
- func (expr DInterval) TypeCheck(args MapArgs) (Datum, error)
- func (DInterval) Walk(_ Visitor)
- type DString
- func (d DString) Compare(other Datum) int
- func (t DString) Eval(_ EvalContext) (Datum, error)
- func (d DString) HasNext() bool
- func (d DString) HasPrev() bool
- func (d DString) IsMax() bool
- func (d DString) IsMin() bool
- func (d DString) Next() Datum
- func (d DString) Prev() Datum
- func (d DString) String() string
- func (d DString) Type() string
- func (expr DString) TypeCheck(args MapArgs) (Datum, error)
- func (DString) Walk(_ Visitor)
- type DTimestamp
- func (d DTimestamp) Compare(other Datum) int
- func (t DTimestamp) Eval(_ EvalContext) (Datum, error)
- func (d DTimestamp) HasNext() bool
- func (d DTimestamp) HasPrev() bool
- func (d DTimestamp) IsMax() bool
- func (d DTimestamp) IsMin() bool
- func (d DTimestamp) Next() Datum
- func (d DTimestamp) Prev() Datum
- func (d DTimestamp) String() string
- func (d DTimestamp) Type() string
- func (expr DTimestamp) TypeCheck(args MapArgs) (Datum, error)
- func (DTimestamp) Walk(_ Visitor)
- type DTuple
- func (d DTuple) Compare(other Datum) int
- func (t DTuple) Eval(_ EvalContext) (Datum, error)
- func (d DTuple) HasNext() bool
- func (d DTuple) HasPrev() bool
- func (d DTuple) IsMax() bool
- func (d DTuple) IsMin() bool
- func (d DTuple) Len() int
- func (d DTuple) Less(i, j int) bool
- func (d DTuple) Next() Datum
- func (d *DTuple) Normalize()
- func (d DTuple) Prev() Datum
- func (d DTuple) String() string
- func (d DTuple) Swap(i, j int)
- func (d DTuple) Type() string
- func (expr DTuple) TypeCheck(args MapArgs) (Datum, error)
- func (DTuple) Walk(_ Visitor)
- type DValArg
- func (d DValArg) Compare(other Datum) int
- func (t DValArg) Eval(_ EvalContext) (Datum, error)
- func (d DValArg) HasNext() bool
- func (d DValArg) HasPrev() bool
- func (DValArg) IsMax() bool
- func (DValArg) IsMin() bool
- func (d DValArg) Next() Datum
- func (d DValArg) Prev() Datum
- func (d DValArg) String() string
- func (DValArg) Type() string
- func (expr DValArg) TypeCheck(args MapArgs) (Datum, error)
- func (DValArg) Variable()
- func (DValArg) Walk(_ Visitor)
- type DateType
- type Datum
- type DecimalType
- type DefaultVal
- type Delete
- type Direction
- type DropDatabase
- type DropIndex
- type DropTable
- type EvalContext
- type ExistsExpr
- type Explain
- type Expr
- type Exprs
- type FloatType
- type FuncExpr
- type Grant
- type GroupBy
- type IfExpr
- type IndexElem
- type IndexElemList
- type IndexIndirection
- type IndexTableDef
- type Indirection
- type IndirectionElem
- type Insert
- type IntType
- type IntVal
- type IntervalType
- type IsOfTypeExpr
- type IsOp
- type IsolationLevel
- type JoinCond
- type JoinTableExpr
- type Limit
- type MapArgs
- type Name
- type NameIndirection
- type NameList
- type NotExpr
- type NotNullConstraint
- type NullConstraint
- type NullIfExpr
- type Nullability
- type NumVal
- type OnJoinCond
- type OrExpr
- type Order
- type OrderBy
- type OverlayExpr
- type ParenExpr
- type ParenSelect
- type ParenTableExpr
- type Parser
- type PrimaryKeyConstraint
- type QualifiedName
- func (n *QualifiedName) Column() string
- func (n *QualifiedName) Database() string
- func (t *QualifiedName) Eval(_ EvalContext) (Datum, error)
- func (n *QualifiedName) Index() string
- func (n *QualifiedName) IsStar() bool
- func (n *QualifiedName) NormalizeColumnName() error
- func (n *QualifiedName) NormalizeTableName(database string) error
- func (n *QualifiedName) String() string
- func (n *QualifiedName) Table() string
- func (expr *QualifiedName) TypeCheck(args MapArgs) (Datum, error)
- func (*QualifiedName) Variable()
- func (*QualifiedName) Walk(_ Visitor)
- type QualifiedNames
- type RangeCond
- type RegexpCache
- type RenameColumn
- type RenameDatabase
- type RenameIndex
- type RenameTable
- type Revoke
- type RollbackTransaction
- type Row
- type Select
- type SelectExpr
- type SelectExprs
- type SelectStatement
- type Set
- type SetTimeZone
- type SetTransaction
- type Show
- type ShowColumns
- type ShowDatabases
- type ShowGrants
- type ShowIndex
- type ShowTables
- type SimpleTableExpr
- type StarIndirection
- type Statement
- type StatementList
- type StatementType
- type StringType
- type Subquery
- type Syntax
- type TableDef
- type TableDefs
- type TableExpr
- type TableExprs
- type TargetList
- type TargetType
- type TimestampType
- type Truncate
- type Tuple
- type UnaryExpr
- type UnaryOp
- type Union
- type UniqueConstraint
- type UniqueConstraintTableDef
- type Update
- type UpdateExpr
- type UpdateExprs
- type UserPriority
- type UsingJoinCond
- type ValArg
- type Values
- type VariableExpr
- type Visitor
- type When
- type Where
Constants ¶
const ( Distinct funcType All )
FuncExpr.Type
const ACTION = 57358
const ADD = 57359
const ALL = 57360
const ALTER = 57361
const ANALYSE = 57362
const ANALYZE = 57363
const AND = 57364
const ANY = 57365
const ARRAY = 57366
const AS = 57367
const ASC = 57368
const ASYMMETRIC = 57369
const AT = 57370
const BCONST = 57349
const BEGIN = 57371
const BETWEEN = 57372
const BIGINT = 57373
const BIT = 57374
const BLOB = 57375
const BOOL = 57376
const BOOLEAN = 57377
const BOTH = 57378
const BY = 57379
const BYTES = 57380
const CASCADE = 57381
const CASE = 57382
const CAST = 57383
const CHAR = 57384
const CHARACTER = 57385
const CHECK = 57386
const COALESCE = 57387
const COLLATE = 57388
const COLLATION = 57389
const COLUMN = 57390
const COLUMNS = 57391
const COMMIT = 57392
const COMMITTED = 57393
const CONCAT = 57394
const CONFLICT = 57395
const CONSTRAINT = 57396
const COVERING = 57397
const CREATE = 57398
const CROSS = 57399
const CUBE = 57400
const CURRENT = 57401
const CURRENT_CATALOG = 57402
const CURRENT_DATE = 57403
const CURRENT_ROLE = 57404
const CURRENT_TIME = 57405
const CURRENT_TIMESTAMP = 57406
const CURRENT_USER = 57407
const CYCLE = 57408
const DATA = 57409
const DATABASE = 57410
const DATABASES = 57411
const DATE = 57412
const DAY = 57413
const DEC = 57414
const DECIMAL = 57415
const DEFAULT = 57416
const DEFERRABLE = 57417
const DELETE = 57418
const DESC = 57419
const DISTINCT = 57420
const DO = 57421
const DOT_DOT = 57353
const DOUBLE = 57422
const DROP = 57423
const ELSE = 57424
const END = 57425
const ERROR = 57357
const ESCAPE = 57426
const EXCEPT = 57427
const EXISTS = 57428
const EXPLAIN = 57429
const EXTRACT = 57430
const FALSE = 57431
const FCONST = 57347
const FETCH = 57432
const FILTER = 57433
const FIRST = 57434
const FLOAT = 57435
const FOLLOWING = 57436
const FOR = 57437
const FOREIGN = 57438
const FROM = 57439
const FULL = 57440
const GRANT = 57441
const GRANTS = 57442
const GREATER_EQUALS = 57355
const GREATEST = 57443
const GROUP = 57444
const GROUPING = 57445
const HAVING = 57446
const HIGH = 57447
const HOUR = 57448
const ICONST = 57350
const IDENT = 57346
const IF = 57449
const IFNULL = 57450
const IN = 57451
const INDEX = 57452
const INITIALLY = 57453
const INNER = 57454
const INSERT = 57455
const INT = 57456
const INT64 = 57457
const INTEGER = 57458
const INTERSECT = 57459
const INTERVAL = 57460
const INTO = 57461
const IS = 57462
const ISOLATION = 57463
const JOIN = 57464
const KEY = 57465
const LATERAL = 57466
const LEADING = 57467
const LEAST = 57468
const LEFT = 57469
const LESS_EQUALS = 57354
const LEVEL = 57470
const LIKE = 57471
const LIMIT = 57472
const LOCAL = 57473
const LOCALTIME = 57474
const LOCALTIMESTAMP = 57475
const LOW = 57476
const LSHIFT = 57477
const MATCH = 57478
const MINUTE = 57479
const MONTH = 57480
const NAME = 57481
const NAMES = 57482
const NATURAL = 57483
const NEXT = 57484
const NO = 57485
const NORMAL = 57486
const NOT = 57487
const NOTHING = 57488
const NOT_EQUALS = 57356
const NOT_LA = 57588
const NULL = 57489
const NULLIF = 57490
const NULLS = 57491
const NUMERIC = 57492
const OF = 57493
const OFF = 57494
const OFFSET = 57495
const ON = 57496
const ONLY = 57497
const OR = 57498
const ORDER = 57499
const ORDINALITY = 57500
const OUT = 57501
const OUTER = 57502
const OVER = 57503
const OVERLAPS = 57504
const OVERLAY = 57505
const PARAM = 57351
const PARTIAL = 57506
const PARTITION = 57507
const PLACING = 57508
const POSITION = 57509
const POSTFIXOP = 57590
const PRECEDING = 57510
const PRECISION = 57511
const PRIMARY = 57512
const PRIORITY = 57513
const RANGE = 57514
const READ = 57515
const REAL = 57516
const RECURSIVE = 57517
const REF = 57518
const REFERENCES = 57519
const RENAME = 57520
const REPEATABLE = 57521
const RESTRICT = 57522
const RETURNING = 57523
const REVOKE = 57524
const RIGHT = 57525
const ROLLBACK = 57526
const ROLLUP = 57527
const ROW = 57528
const ROWS = 57529
const RSHIFT = 57530
const SCONST = 57348
const SEARCH = 57531
const SECOND = 57532
const SELECT = 57533
const SERIALIZABLE = 57534
const SESSION = 57535
const SESSION_USER = 57536
const SET = 57537
const SHOW = 57538
const SIMILAR = 57539
const SIMPLE = 57540
const SMALLINT = 57541
const SNAPSHOT = 57542
const SOME = 57543
const SQL = 57544
const START = 57545
const STORING = 57548
const STRICT = 57546
const STRING = 57547
const SUBSTRING = 57549
const SYMMETRIC = 57550
const TABLE = 57551
const TABLES = 57552
const TEXT = 57553
const THEN = 57554
const TIME = 57555
const TIMESTAMP = 57556
const TO = 57557
const TRAILING = 57558
const TRANSACTION = 57559
const TREAT = 57560
const TRIM = 57561
const TRUE = 57562
const TRUNCATE = 57563
const TYPE = 57564
const TYPECAST = 57352
const (
TimestampWithOffsetZoneFormat = "2006-01-02 15:04:05.999999999-07:00"
)
time.Time formats.
const UMINUS = 57591
const UNBOUNDED = 57565
const UNCOMMITTED = 57566
const UNION = 57567
const UNIQUE = 57568
const UNKNOWN = 57569
const UPDATE = 57570
const USER = 57571
const USING = 57572
const VALID = 57573
const VALIDATE = 57574
const VALUE = 57575
const VALUES = 57576
const VARCHAR = 57577
const VARIADIC = 57578
const VARYING = 57579
const WHEN = 57580
const WHERE = 57581
const WINDOW = 57582
const WITH = 57583
const WITHIN = 57584
const WITHOUT = 57585
const WITH_LA = 57589
const YEAR = 57586
const ZONE = 57587
Variables ¶
This section is empty.
Functions ¶
func ContainsVars ¶
ContainsVars returns true if the expression contains any variables.
func FillArgs ¶
FillArgs replaces any placeholder nodes in the expression with arguments supplied with the query.
func SimilarEscape ¶
SimilarEscape converts a SQL:2008 regexp pattern to POSIX style, so it can be used by our regexp engine.
Types ¶
type AliasedTableExpr ¶
type AliasedTableExpr struct { Expr SimpleTableExpr As Name }
AliasedTableExpr represents a table expression coupled with an optional alias.
func (*AliasedTableExpr) String ¶
func (node *AliasedTableExpr) String() string
type AlterTable ¶
type AlterTable struct { IfExists bool Table *QualifiedName Cmds AlterTableCmds }
AlterTable represents an ALTER TABLE statement.
func (*AlterTable) StatementType ¶
func (*AlterTable) StatementType() StatementType
StatementType implements the Statement interface.
func (*AlterTable) String ¶
func (node *AlterTable) String() string
type AlterTableAddColumn ¶
type AlterTableAddColumn struct { IfNotExists bool ColumnDef *ColumnTableDef // contains filtered or unexported fields }
AlterTableAddColumn represents an ADD COLUMN command.
func (*AlterTableAddColumn) String ¶
func (node *AlterTableAddColumn) String() string
type AlterTableAddConstraint ¶
type AlterTableAddConstraint struct {
ConstraintDef ConstraintTableDef
}
AlterTableAddConstraint represents an ADD CONSTRAINT command.
func (*AlterTableAddConstraint) String ¶
func (node *AlterTableAddConstraint) String() string
type AlterTableCmd ¶
type AlterTableCmd interface {
// contains filtered or unexported methods
}
AlterTableCmd represents a table modification operation.
type AlterTableCmds ¶
type AlterTableCmds []AlterTableCmd
AlterTableCmds represents a list of table alterations.
func (AlterTableCmds) String ¶
func (node AlterTableCmds) String() string
type AlterTableDropColumn ¶
type AlterTableDropColumn struct { IfExists bool Column string // contains filtered or unexported fields }
AlterTableDropColumn represents a DROP COLUMN command.
func (*AlterTableDropColumn) String ¶
func (node *AlterTableDropColumn) String() string
type AlterTableDropConstraint ¶
AlterTableDropConstraint represents a DROP CONSTRAINT command.
func (*AlterTableDropConstraint) String ¶
func (node *AlterTableDropConstraint) String() string
type AndExpr ¶
type AndExpr struct {
Left, Right Expr
}
AndExpr represents an AND expression.
func (*AndExpr) Eval ¶
func (expr *AndExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type Args ¶
Args defines the interface for retrieving arguments. Return false for the second return value if the argument cannot be found.
type Array ¶
type Array Exprs
Array represents an array constructor.
func (Array) Eval ¶
func (t Array) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type ArrayIndirection ¶
ArrayIndirection represents "[<begin>:<end>]" in an indirection expression.
func (*ArrayIndirection) String ¶
func (a *ArrayIndirection) String() string
type BeginTransaction ¶
type BeginTransaction struct { Isolation IsolationLevel UserPriority UserPriority }
BeginTransaction represents a BEGIN statement
func (*BeginTransaction) StatementType ¶
func (*BeginTransaction) StatementType() StatementType
StatementType implements the Statement interface.
func (*BeginTransaction) String ¶
func (node *BeginTransaction) String() string
type BinaryExpr ¶
type BinaryExpr struct { Operator BinaryOp Left, Right Expr // contains filtered or unexported fields }
BinaryExpr represents a binary value expression.
func (*BinaryExpr) Eval ¶
func (expr *BinaryExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*BinaryExpr) String ¶
func (node *BinaryExpr) String() string
func (*BinaryExpr) TypeCheck ¶
func (expr *BinaryExpr) TypeCheck(args MapArgs) (Datum, error)
TypeCheck implements the Expr interface.
func (*BinaryExpr) Walk ¶
func (expr *BinaryExpr) Walk(v Visitor)
Walk implements the Expr interface.
type CaseExpr ¶
CaseExpr represents a CASE expression.
func (*CaseExpr) Eval ¶
func (expr *CaseExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type CastExpr ¶
type CastExpr struct { Expr Expr Type ColumnType }
CastExpr represents a CAST(expr AS type) expression.
func (*CastExpr) Eval ¶
func (expr *CastExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type CoalesceExpr ¶
CoalesceExpr represents a COALESCE or IFNULL expression.
func (*CoalesceExpr) Eval ¶
func (expr *CoalesceExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*CoalesceExpr) String ¶
func (node *CoalesceExpr) String() string
func (*CoalesceExpr) TypeCheck ¶
func (expr *CoalesceExpr) TypeCheck(args MapArgs) (Datum, error)
TypeCheck implements the Expr interface.
func (*CoalesceExpr) Walk ¶
func (expr *CoalesceExpr) Walk(v Visitor)
Walk implements the Expr interface.
type ColumnDefault ¶
type ColumnDefault struct {
Expr Expr
}
ColumnDefault represents a DEFAULT clause for a column.
type ColumnQualification ¶
type ColumnQualification interface {
// contains filtered or unexported methods
}
ColumnQualification represents a constraint on a column.
type ColumnTableDef ¶
type ColumnTableDef struct { Name Name Type ColumnType Nullable Nullability PrimaryKey bool Unique bool DefaultExpr Expr }
ColumnTableDef represents a column definition within a CREATE TABLE statement.
func (*ColumnTableDef) String ¶
func (node *ColumnTableDef) String() string
type ColumnType ¶
ColumnType represents a type in a column definition.
type CommitTransaction ¶
type CommitTransaction struct{}
CommitTransaction represents a COMMIT statement.
func (*CommitTransaction) StatementType ¶
func (*CommitTransaction) StatementType() StatementType
StatementType implements the Statement interface.
func (*CommitTransaction) String ¶
func (node *CommitTransaction) String() string
type ComparisonExpr ¶
type ComparisonExpr struct { Operator ComparisonOp Left, Right Expr // contains filtered or unexported fields }
ComparisonExpr represents a two-value comparison expression.
func (*ComparisonExpr) Eval ¶
func (expr *ComparisonExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*ComparisonExpr) String ¶
func (node *ComparisonExpr) String() string
func (*ComparisonExpr) TypeCheck ¶
func (expr *ComparisonExpr) TypeCheck(args MapArgs) (Datum, error)
TypeCheck implements the Expr interface.
func (*ComparisonExpr) Walk ¶
func (expr *ComparisonExpr) Walk(v Visitor)
Walk implements the Expr interface.
type ComparisonOp ¶
type ComparisonOp int
ComparisonOp represents a binary operator.
const ( EQ ComparisonOp = iota LT GT LE GE NE In NotIn Like NotLike SimilarTo NotSimilarTo IsDistinctFrom IsNotDistinctFrom Is IsNot )
ComparisonExpr.Operator
func (ComparisonOp) String ¶
func (i ComparisonOp) String() string
type ConstraintTableDef ¶
type ConstraintTableDef interface { TableDef // contains filtered or unexported methods }
ConstraintTableDef represents a constraint definition within a CREATE TABLE statement.
type CreateDatabase ¶
CreateDatabase represents a CREATE DATABASE statement.
func (*CreateDatabase) StatementType ¶
func (*CreateDatabase) StatementType() StatementType
StatementType implements the Statement interface.
func (*CreateDatabase) String ¶
func (node *CreateDatabase) String() string
type CreateIndex ¶
type CreateIndex struct { Name Name Table *QualifiedName Unique bool IfNotExists bool Columns IndexElemList // Extra columns to be stored together with the indexed ones as an optimization // for improved reading performance. Storing NameList }
CreateIndex represents a CREATE INDEX statement.
func (*CreateIndex) StatementType ¶
func (*CreateIndex) StatementType() StatementType
StatementType implements the Statement interface.
func (*CreateIndex) String ¶
func (node *CreateIndex) String() string
type CreateTable ¶
type CreateTable struct { IfNotExists bool Table *QualifiedName Defs TableDefs }
CreateTable represents a CREATE TABLE statement.
func (*CreateTable) StatementType ¶
func (*CreateTable) StatementType() StatementType
StatementType implements the Statement interface.
func (*CreateTable) String ¶
func (node *CreateTable) String() string
type DBool ¶
type DBool bool
DBool is the boolean Datum.
func (DBool) Eval ¶
func (t DBool) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type DBytes ¶
type DBytes string
DBytes is the bytes Datum. The underlying type is a string because we want the immutability, but this may contain arbitrary bytes.
func (DBytes) Eval ¶
func (t DBytes) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type DDate ¶
type DDate int64
DDate is the date Datum represented as the number of days after the Unix epoch.
func (DDate) Eval ¶
func (t DDate) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type DDecimal ¶
DDecimal is the decimal Datum.
func (DDecimal) Eval ¶
func (t DDecimal) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type DFloat ¶
type DFloat float64
DFloat is the float Datum.
func (DFloat) Eval ¶
func (t DFloat) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type DInt ¶
type DInt int64
DInt is the int Datum.
func (DInt) Eval ¶
func (t DInt) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type DInterval ¶
DInterval is the interval Datum.
func (DInterval) Eval ¶
func (t DInterval) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type DString ¶
type DString string
DString is the string Datum.
func (DString) Eval ¶
func (t DString) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type DTimestamp ¶
DTimestamp is the timestamp Datum.
func (DTimestamp) Compare ¶
func (d DTimestamp) Compare(other Datum) int
Compare implements the Datum interface.
func (DTimestamp) Eval ¶
func (t DTimestamp) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (DTimestamp) HasNext ¶
func (d DTimestamp) HasNext() bool
HasNext implements the Datum interface.
func (DTimestamp) HasPrev ¶
func (d DTimestamp) HasPrev() bool
HasPrev implements the Datum interface.
func (DTimestamp) String ¶
func (d DTimestamp) String() string
type DTuple ¶
type DTuple []Datum
DTuple is the tuple Datum.
func (DTuple) Eval ¶
func (t DTuple) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*DTuple) Normalize ¶
func (d *DTuple) Normalize()
Normalize sorts and uniques the datum tuple.
type DValArg ¶
type DValArg struct {
// contains filtered or unexported fields
}
DValArg is the named bind var argument Datum.
func (DValArg) Eval ¶
func (t DValArg) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type Datum ¶
type Datum interface { Expr Type() string // Compare returns -1 if the receiver is less than other, 0 if receiver is // equal to other and +1 if receiver is greater than other. Compare(other Datum) int // HasPrev specifies if Prev() can be used to compute a previous value for // a datum. For example, DBytes doesn't support it (the previous for BB is BAZZZ..). HasPrev() bool // Prev returns the previous datum. If the receiver is "b" and the returned datum // is "a", then "a < b" and no other datum will compare such that "a < c < // b". // The return value is undefined if `IsMin()`. Prev() Datum // HasNext specifies if Next() can be used to compute a next value for a // datum. For example, DDecimal doesn't support it (the next for 1.0 is 1.00..1). HasNext() bool // Next returns the next datum. If the receiver is "a" and the returned datum // is "b", then "a < b" and no other datum will compare such that "a < c < // b". // The return value is undefined if `IsMax()`. Next() Datum // IsMax returns true if the datum is equal to the maximum value the datum // type can hold. IsMax() bool // IsMin returns true if the datum is equal to the minimum value the datum // type can hold. IsMin() bool }
A Datum holds either a bool, int64, float64, string or []Datum.
var ( // DummyBool is a placeholder DBool value. DummyBool Datum = DBool(false) // DummyInt is a placeholder DInt value. DummyInt Datum = DInt(0) // DummyFloat is a placeholder DFloat value. DummyFloat Datum = DFloat(0) // DummyDecimal is a placeholder DDecimal value. DummyDecimal Datum = DDecimal{} // DummyString is a placeholder DString value. DummyString Datum = DString("") // DummyBytes is a placeholder DBytes value. DummyBytes Datum = DBytes("") // DummyDate is a placeholder DDate value. DummyDate Datum = DDate(0) // DummyTimestamp is a placeholder DTimestamp value. DummyTimestamp Datum = DTimestamp{} // DummyInterval is a placeholder DInterval value. DummyInterval Datum = DInterval{} // DNull is the NULL Datum. DNull Datum = dNull{} )
type DecimalType ¶
DecimalType represents a DECIMAL or NUMERIC type.
func (*DecimalType) String ¶
func (node *DecimalType) String() string
type DefaultVal ¶
type DefaultVal struct{}
DefaultVal represents the DEFAULT expression.
func (DefaultVal) Eval ¶
func (t DefaultVal) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (DefaultVal) String ¶
func (node DefaultVal) String() string
type Delete ¶
Delete represents a DELETE statement.
func (*Delete) StatementType ¶
func (*Delete) StatementType() StatementType
StatementType implements the Statement interface.
type DropDatabase ¶
DropDatabase represents a DROP DATABASE statement.
func (*DropDatabase) StatementType ¶
func (*DropDatabase) StatementType() StatementType
StatementType implements the Statement interface.
func (*DropDatabase) String ¶
func (node *DropDatabase) String() string
type DropIndex ¶
type DropIndex struct { Names QualifiedNames IfExists bool }
DropIndex represents a DROP INDEX statement.
func (*DropIndex) StatementType ¶
func (*DropIndex) StatementType() StatementType
StatementType implements the Statement interface.
type DropTable ¶
type DropTable struct { Names QualifiedNames IfExists bool }
DropTable represents a DROP TABLE statement.
func (*DropTable) StatementType ¶
func (*DropTable) StatementType() StatementType
StatementType implements the Statement interface.
type EvalContext ¶
type EvalContext struct { NodeID roachpb.NodeID StmtTimestamp DTimestamp TxnTimestamp DTimestamp ReCache *RegexpCache GetLocation func() (*time.Location, error) Args MapArgs }
EvalContext defines the context in which to evaluate an expression, allowing the retrieval of state such as the node ID or statement start time.
func (EvalContext) NormalizeExpr ¶
func (ctx EvalContext) NormalizeExpr(expr Expr) (Expr, error)
NormalizeExpr normalizes an expression, simplifying where possible, but guaranteeing that the result of evaluating the expression is unchanged. Example normalizations:
(a) -> a ROW(a, b, c) -> (a, b, c) a = 1 + 1 -> a = 2 a + 1 = 2 -> a = 1 a BETWEEN b AND c -> (a >= b) AND (a <= c) a NOT BETWEEN b AND c -> (a < b) OR (a > c)
func (EvalContext) ParseTimestamp ¶
func (ctx EvalContext) ParseTimestamp(s DString) (DTimestamp, error)
ParseTimestamp parses the timestamp.
type ExistsExpr ¶
type ExistsExpr struct {
Subquery Expr
}
ExistsExpr represents an EXISTS expression.
func (*ExistsExpr) Eval ¶
func (t *ExistsExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*ExistsExpr) String ¶
func (node *ExistsExpr) String() string
func (*ExistsExpr) TypeCheck ¶
func (expr *ExistsExpr) TypeCheck(args MapArgs) (Datum, error)
TypeCheck implements the Expr interface.
func (*ExistsExpr) Walk ¶
func (expr *ExistsExpr) Walk(v Visitor)
Walk implements the Expr interface.
type Explain ¶
Explain represents an EXPLAIN statement.
func (*Explain) StatementType ¶
func (*Explain) StatementType() StatementType
StatementType implements the Statement interface.
type Expr ¶
type Expr interface { fmt.Stringer // Walk replaces each child of the receiver with the return of // `WalkExpr(v, child)`. For childless (leaf) Exprs, its // implementation is empty. Walk(Visitor) // TypeCheck returns the zero value of the expression's type, or an // error if the expression doesn't type-check. args maps bind var argument // names to types. TypeCheck(args MapArgs) (Datum, error) // Eval evaluates an SQL expression. Expression evaluation is a mostly // straightforward walk over the parse tree. The only significant complexity is // the handling of types and implicit conversions. See binOps and cmpOps for // more details. Note that expression evaluation returns an error if certain // node types are encountered: ValArg, QualifiedName or Subquery. These nodes // should be replaced prior to expression evaluation by an appropriate // WalkExpr. For example, ValArg should be replace by the argument passed from // the client. Eval(EvalContext) (Datum, error) }
Expr represents an expression.
func ParseExprTraditional ¶
ParseExprTraditional is a short-hand for parseExpr(sql, Traditional)
type Exprs ¶
type Exprs []Expr
Exprs represents a list of value expressions. It's not a valid expression because it's not parenthesized.
type FuncExpr ¶
type FuncExpr struct { Name *QualifiedName Type funcType Exprs Exprs // contains filtered or unexported fields }
FuncExpr represents a function call.
func (*FuncExpr) Eval ¶
func (expr *FuncExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type Grant ¶
type Grant struct { Privileges privilege.List Targets TargetList Grantees NameList }
Grant represents a GRANT statement.
func (*Grant) StatementType ¶
func (*Grant) StatementType() StatementType
StatementType implements the Statement interface.
type IfExpr ¶
IfExpr represents an IF expression.
func (*IfExpr) Eval ¶
func (expr *IfExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type IndexElemList ¶
type IndexElemList []IndexElem
IndexElemList is list of IndexElem.
func NameListToIndexElems ¶
func NameListToIndexElems(lst NameList) IndexElemList
NameListToIndexElems converts a NameList to an IndexElemList with all members using the `DefaultDirection`.
func (IndexElemList) String ¶
func (l IndexElemList) String() string
String formats the contained names as a comma-separated, escaped string.
type IndexIndirection ¶
type IndexIndirection Name
IndexIndirection represents ":<name>" in an indirection expression.
func (IndexIndirection) String ¶
func (n IndexIndirection) String() string
type IndexTableDef ¶
type IndexTableDef struct { Name Name Columns IndexElemList Storing NameList }
IndexTableDef represents an index definition within a CREATE TABLE statement.
func (*IndexTableDef) String ¶
func (node *IndexTableDef) String() string
type Indirection ¶
type Indirection []IndirectionElem
Indirection represents an indirection expression composed of a series of indirection elements.
func (Indirection) String ¶
func (i Indirection) String() string
type IndirectionElem ¶
type IndirectionElem interface { String() string // contains filtered or unexported methods }
IndirectionElem is a single element in an indirection expression.
type Insert ¶
type Insert struct { Table *QualifiedName Columns QualifiedNames Rows SelectStatement }
Insert represents an INSERT statement.
func (*Insert) DefaultValues ¶
DefaultValues returns true iff only default values are being inserted.
func (*Insert) StatementType ¶
func (*Insert) StatementType() StatementType
StatementType implements the Statement interface.
type IntVal ¶
IntVal represents an integer.
func (*IntVal) Eval ¶
func (t *IntVal) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type IntervalType ¶
type IntervalType struct { }
IntervalType represents an INTERVAL type
func (*IntervalType) String ¶
func (node *IntervalType) String() string
type IsOfTypeExpr ¶
type IsOfTypeExpr struct { Not bool Expr Expr Types []ColumnType }
IsOfTypeExpr represents an IS {,NOT} OF (type_list) expression.
func (*IsOfTypeExpr) Eval ¶
func (expr *IsOfTypeExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*IsOfTypeExpr) String ¶
func (node *IsOfTypeExpr) String() string
func (*IsOfTypeExpr) TypeCheck ¶
func (expr *IsOfTypeExpr) TypeCheck(args MapArgs) (Datum, error)
TypeCheck implements the Expr interface.
func (*IsOfTypeExpr) Walk ¶
func (*IsOfTypeExpr) Walk(_ Visitor)
Walk implements the Expr interface.
type IsolationLevel ¶
type IsolationLevel int
IsolationLevel holds the isolation level for a transaction.
const ( UnspecifiedIsolation IsolationLevel = iota SnapshotIsolation SerializableIsolation )
IsolationLevel values
func (IsolationLevel) String ¶
func (i IsolationLevel) String() string
type JoinCond ¶
type JoinCond interface {
// contains filtered or unexported methods
}
JoinCond represents a join condition.
type JoinTableExpr ¶
JoinTableExpr represents a TableExpr that's a JOIN operation.
func (*JoinTableExpr) String ¶
func (node *JoinTableExpr) String() string
type MapArgs ¶
MapArgs is an Args implementation which is used for the type inference necessary to support the postgres wire protocol. See various TypeCheck() implementations for details.
func (MapArgs) SetInferredType ¶
SetInferredType sets the bind var argument d to the type typ in m. If m is nil or d is not a DValArg, nil is returned. If the bind var argument is set, typ is returned. An error is returned if typ cannot be set because a different type is already present.
type NameIndirection ¶
type NameIndirection Name
NameIndirection represents ".<name>" in an indirection expression.
func (NameIndirection) String ¶
func (n NameIndirection) String() string
type NameList ¶
type NameList []string
A NameList is a list of identifier. TODO(tschottdorf): would be nicer to have []Name here but unless we want to introduce new types to the grammar, NameList([]string{...}) needs to work.
type NotExpr ¶
type NotExpr struct {
Expr Expr
}
NotExpr represents a NOT expression.
func (*NotExpr) Eval ¶
func (expr *NotExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type NotNullConstraint ¶
type NotNullConstraint struct{}
NotNullConstraint represents NOT NULL on a column.
type NullIfExpr ¶
NullIfExpr represents a NULLIF expression.
func (*NullIfExpr) Eval ¶
func (expr *NullIfExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*NullIfExpr) String ¶
func (node *NullIfExpr) String() string
func (*NullIfExpr) TypeCheck ¶
func (expr *NullIfExpr) TypeCheck(args MapArgs) (Datum, error)
TypeCheck implements the Expr interface.
func (*NullIfExpr) Walk ¶
func (expr *NullIfExpr) Walk(v Visitor)
Walk implements the Expr interface.
type Nullability ¶
type Nullability int
Nullability represents either NULL, NOT NULL or an unspecified value (silent NULL).
const ( NotNull Nullability = iota Null SilentNull )
The values for NullType.
type NumVal ¶
type NumVal string
NumVal represents a number.
func (NumVal) Eval ¶
func (t NumVal) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type OnJoinCond ¶
type OnJoinCond struct {
Expr Expr
}
OnJoinCond represents an ON join condition.
func (*OnJoinCond) String ¶
func (node *OnJoinCond) String() string
type OrExpr ¶
type OrExpr struct {
Left, Right Expr
}
OrExpr represents an OR expression.
func (*OrExpr) Eval ¶
func (expr *OrExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type OverlayExpr ¶
type OverlayExpr struct {
FuncExpr
}
OverlayExpr represents an overlay function call.
func (*OverlayExpr) String ¶
func (node *OverlayExpr) String() string
type ParenSelect ¶
type ParenSelect struct {
Select SelectStatement
}
ParenSelect represents a parenthesized SELECT/UNION/VALUES statement.
func (*ParenSelect) StatementType ¶
func (*ParenSelect) StatementType() StatementType
StatementType implements the Statement interface.
func (*ParenSelect) String ¶
func (node *ParenSelect) String() string
type ParenTableExpr ¶
type ParenTableExpr struct {
Expr TableExpr
}
ParenTableExpr represents a parenthesized TableExpr.
func (*ParenTableExpr) String ¶
func (node *ParenTableExpr) String() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser wraps a scanner, parser and other utilities present in the parser package.
func (*Parser) FillArgs ¶
FillArgs replaces any placeholder nodes in the expression with arguments supplied with the query.
func (*Parser) NormalizeExpr ¶
func (p *Parser) NormalizeExpr(ctx EvalContext, expr Expr) (Expr, error)
NormalizeExpr is wrapper around ctx.NormalizeExpr which avoids allocation of a normalizeVisitor.
func (*Parser) Parse ¶
func (p *Parser) Parse(sql string, syntax Syntax) (StatementList, error)
Parse parses the sql and returns a list of statements.
func (*Parser) TypeCheckAndNormalizeExpr ¶
func (p *Parser) TypeCheckAndNormalizeExpr(ctx EvalContext, expr Expr) (Expr, error)
TypeCheckAndNormalizeExpr is a combination of TypeCheck() and NormalizeExpr(). It returns an error if either of TypeCheck() or NormalizeExpr() return one, and otherwise returns the Expr returned by NormalizeExpr().
type PrimaryKeyConstraint ¶
type PrimaryKeyConstraint struct{}
PrimaryKeyConstraint represents NULL on a column.
type QualifiedName ¶
type QualifiedName struct { Base Name Indirect Indirection // contains filtered or unexported fields }
QualifiedName is a base name and an optional indirection expression.
func StarExpr ¶
func StarExpr() *QualifiedName
StarExpr is a convenience function that represents an unqualified "*".
func (*QualifiedName) Column ¶
func (n *QualifiedName) Column() string
Column returns the column portion of the name. Note that the returned string is not quoted even if the name is a keyword.
func (*QualifiedName) Database ¶
func (n *QualifiedName) Database() string
Database returns the database portion of the name. Note that the returned string is not quoted even if the name is a keyword.
func (*QualifiedName) Eval ¶
func (t *QualifiedName) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*QualifiedName) Index ¶
func (n *QualifiedName) Index() string
Index returns the index portion of the name. Note that the returned string is not quoted even if the name is a keyword.
func (*QualifiedName) IsStar ¶
func (n *QualifiedName) IsStar() bool
IsStar returns true iff the qualified name contains matches "".* or table.*.
func (*QualifiedName) NormalizeColumnName ¶
func (n *QualifiedName) NormalizeColumnName() error
NormalizeColumnName normalizes the qualified name to contain a table name as prefix, returning an error if unable to do so or if the name is not a valid column name (e.g. it contains too many indirections). If normalization occurred, the modified qualified name will have n.Base == "" to indicate no explicit table was specified. The incoming qualified name should have one of the following forms:
* table.* column column[array-indirection] table.column table.column[array-indirection]
Note that "table" may be the empty string. On successful normalization the qualified name will have one of the forms:
table.* table.column table.column[array-indirection]
func (*QualifiedName) NormalizeTableName ¶
func (n *QualifiedName) NormalizeTableName(database string) error
NormalizeTableName normalizes the qualified name to contain a database name as prefix, returning an error if unable to do so or if the name is not a valid table name (e.g. it contains an array indirection). The incoming qualified name should have one of the following forms:
table database.table table@index database.table@index
On successful normalization, the qualified name will have the form:
database.table@index
func (*QualifiedName) String ¶
func (n *QualifiedName) String() string
func (*QualifiedName) Table ¶
func (n *QualifiedName) Table() string
Table returns the table portion of the name. Note that the returned string is not quoted even if the name is a keyword.
func (*QualifiedName) TypeCheck ¶
func (expr *QualifiedName) TypeCheck(args MapArgs) (Datum, error)
TypeCheck implements the Expr interface.
func (*QualifiedName) Variable ¶
func (*QualifiedName) Variable()
Variable implements the VariableExpr interface.
func (*QualifiedName) Walk ¶
func (*QualifiedName) Walk(_ Visitor)
Walk implements the Expr interface.
type QualifiedNames ¶
type QualifiedNames []*QualifiedName
QualifiedNames represents a command separated list (see the String method) of qualified names.
func (QualifiedNames) String ¶
func (n QualifiedNames) String() string
type RangeCond ¶
RangeCond represents a BETWEEN or a NOT BETWEEN expression.
func (*RangeCond) Eval ¶
func (t *RangeCond) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type RegexpCache ¶
type RegexpCache struct {
// contains filtered or unexported fields
}
A RegexpCache is a cache used to store compiled regular expressions. The cache is safe for concurrent use by multiple goroutines. It is also safe to use the cache through a nil reference, where it will act like a valid cache with no capacity.
func NewRegexpCache ¶
func NewRegexpCache(size int) *RegexpCache
NewRegexpCache creates a new RegexpCache of the given size. The underlying cache internally uses a hash map, so lookups are cheap.
func (*RegexpCache) Clear ¶
func (rc *RegexpCache) Clear()
Clear clears all regular expressions from the cache.
func (*RegexpCache) GetRegexp ¶
func (rc *RegexpCache) GetRegexp(key regexpCacheKey) (*regexp.Regexp, error)
GetRegexp consults the cache for the regular expressions stored for the given key, compiling the key's pattern if it is not already in the cache.
func (*RegexpCache) Len ¶
func (rc *RegexpCache) Len() int
Len returns the number of compiled regular expressions in the cache.
type RenameColumn ¶
type RenameColumn struct { Table *QualifiedName Name Name NewName Name // IfExists refers to the table, not the column. IfExists bool }
RenameColumn represents a RENAME COLUMN statement.
func (*RenameColumn) StatementType ¶
func (*RenameColumn) StatementType() StatementType
StatementType implements the Statement interface.
func (*RenameColumn) String ¶
func (node *RenameColumn) String() string
type RenameDatabase ¶
RenameDatabase represents a RENAME DATABASE statement.
func (*RenameDatabase) StatementType ¶
func (*RenameDatabase) StatementType() StatementType
StatementType implements the Statement interface.
func (*RenameDatabase) String ¶
func (node *RenameDatabase) String() string
type RenameIndex ¶
type RenameIndex struct { Name *QualifiedName NewName Name IfExists bool }
RenameIndex represents a RENAME INDEX statement.
func (*RenameIndex) StatementType ¶
func (*RenameIndex) StatementType() StatementType
StatementType implements the Statement interface.
func (*RenameIndex) String ¶
func (node *RenameIndex) String() string
type RenameTable ¶
type RenameTable struct { Name *QualifiedName NewName *QualifiedName IfExists bool }
RenameTable represents a RENAME TABLE statement.
func (*RenameTable) StatementType ¶
func (*RenameTable) StatementType() StatementType
StatementType implements the Statement interface.
func (*RenameTable) String ¶
func (node *RenameTable) String() string
type Revoke ¶
type Revoke struct { Privileges privilege.List Targets TargetList Grantees NameList }
Revoke represents a REVOKE statements. PrivilegeList and TargetList are defined in grant.go
func (*Revoke) StatementType ¶
func (*Revoke) StatementType() StatementType
StatementType implements the Statement interface.
type RollbackTransaction ¶
type RollbackTransaction struct{}
RollbackTransaction represents a ROLLBACK statement.
func (*RollbackTransaction) StatementType ¶
func (*RollbackTransaction) StatementType() StatementType
StatementType implements the Statement interface.
func (*RollbackTransaction) String ¶
func (node *RollbackTransaction) String() string
type Row ¶
type Row Exprs
Row represents a parenthesized list of expressions. Similar to Tuple except in how it is textually represented.
func (Row) Eval ¶
func (t Row) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type Select ¶
type Select struct { Distinct bool Exprs SelectExprs From TableExprs Where *Where GroupBy GroupBy Having *Where OrderBy OrderBy Limit *Limit Lock string // contains filtered or unexported fields }
Select represents a SELECT statement.
func (*Select) StatementType ¶
func (*Select) StatementType() StatementType
StatementType implements the Statement interface.
type SelectExpr ¶
SelectExpr represents a SELECT expression.
func (SelectExpr) String ¶
func (node SelectExpr) String() string
type SelectExprs ¶
type SelectExprs []SelectExpr
SelectExprs represents SELECT expressions.
func (SelectExprs) String ¶
func (node SelectExprs) String() string
type SelectStatement ¶
type SelectStatement interface { Statement // contains filtered or unexported methods }
SelectStatement any SELECT statement.
type Set ¶
type Set struct { Name *QualifiedName Values Exprs }
Set represents a SET statement.
func (*Set) StatementType ¶
func (*Set) StatementType() StatementType
StatementType implements the Statement interface.
type SetTimeZone ¶
type SetTimeZone struct {
Value Expr
}
SetTimeZone represents a SET TIME ZONE statement.
func (*SetTimeZone) StatementType ¶
func (*SetTimeZone) StatementType() StatementType
StatementType implements the Statement interface.
func (*SetTimeZone) String ¶
func (node *SetTimeZone) String() string
type SetTransaction ¶
type SetTransaction struct { Isolation IsolationLevel UserPriority UserPriority }
SetTransaction represents a SET TRANSACTION statement.
func (*SetTransaction) StatementType ¶
func (*SetTransaction) StatementType() StatementType
StatementType implements the Statement interface.
func (*SetTransaction) String ¶
func (node *SetTransaction) String() string
type Show ¶
type Show struct {
Name string
}
Show represents a SHOW statement.
func (*Show) StatementType ¶
func (*Show) StatementType() StatementType
StatementType implements the Statement interface.
type ShowColumns ¶
type ShowColumns struct {
Table *QualifiedName
}
ShowColumns represents a SHOW COLUMNS statement.
func (*ShowColumns) StatementType ¶
func (*ShowColumns) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowColumns) String ¶
func (node *ShowColumns) String() string
type ShowDatabases ¶
type ShowDatabases struct { }
ShowDatabases represents a SHOW DATABASES statement.
func (*ShowDatabases) StatementType ¶
func (*ShowDatabases) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowDatabases) String ¶
func (node *ShowDatabases) String() string
type ShowGrants ¶
type ShowGrants struct { Targets *TargetList Grantees NameList }
ShowGrants represents a SHOW GRANTS statement. TargetList is defined in grant.go.
func (*ShowGrants) StatementType ¶
func (*ShowGrants) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowGrants) String ¶
func (node *ShowGrants) String() string
type ShowIndex ¶
type ShowIndex struct {
Table *QualifiedName
}
ShowIndex represents a SHOW INDEX statement.
func (*ShowIndex) StatementType ¶
func (*ShowIndex) StatementType() StatementType
StatementType implements the Statement interface.
type ShowTables ¶
type ShowTables struct {
Name *QualifiedName
}
ShowTables represents a SHOW TABLES statement.
func (*ShowTables) StatementType ¶
func (*ShowTables) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowTables) String ¶
func (node *ShowTables) String() string
type SimpleTableExpr ¶
type SimpleTableExpr interface {
// contains filtered or unexported methods
}
SimpleTableExpr represents a simple table expression.
type StarIndirection ¶
type StarIndirection string
StarIndirection represents ".*" in an indirection expression.
func (StarIndirection) String ¶
func (s StarIndirection) String() string
type Statement ¶
type Statement interface { fmt.Stringer StatementType() StatementType }
Statement represents a statement.
func ParseOneTraditional ¶
ParseOneTraditional is short-hand for parseOne(sql, Traditional)
type StatementList ¶
type StatementList []Statement
StatementList is a list of statements.
func (StatementList) String ¶
func (l StatementList) String() string
type StatementType ¶
type StatementType int
StatementType is the enumerated type for Statement return styles on the wire.
const ( // Ack indicates that the statement does not have a meaningful // return. Examples include SET, BEGIN, COMMIT. Ack StatementType = iota // DDL indicates that the statement mutates the database schema. DDL // RowsAffected indicates that the statement returns the count of // affected rows. RowsAffected // Rows indicates that the statement returns the affected rows after // the statement was applied. Rows )
type StringType ¶
StringType represents a STRING, CHAR or VARCHAR type.
func (*StringType) String ¶
func (node *StringType) String() string
type Subquery ¶
type Subquery struct {
Select SelectStatement
}
Subquery represents a subquery.
func (*Subquery) Eval ¶
func (t *Subquery) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type TableDef ¶
type TableDef interface {
// contains filtered or unexported methods
}
TableDef represents a column or index definition within a CREATE TABLE statement.
type TableExpr ¶
type TableExpr interface {
// contains filtered or unexported methods
}
TableExpr represents a table expression.
type TableExprs ¶
type TableExprs []TableExpr
TableExprs represents a list of table expressions.
func (TableExprs) String ¶
func (node TableExprs) String() string
type TargetList ¶
type TargetList struct { Databases NameList Tables QualifiedNames }
TargetList represents a list of targets. Only one field may be non-nil.
func (TargetList) String ¶
func (tl TargetList) String() string
type TargetType ¶
type TargetType int
TargetType represents the type of target.
const (
TargetDatabase TargetType = iota
)
Enums for target and privilege types.
func (TargetType) String ¶
func (tt TargetType) String() string
type TimestampType ¶
type TimestampType struct { }
TimestampType represents a TIMESTAMP type.
func (*TimestampType) String ¶
func (node *TimestampType) String() string
type Truncate ¶
type Truncate struct {
Tables QualifiedNames
}
Truncate represents a TRUNCATE statement.
func (*Truncate) StatementType ¶
func (*Truncate) StatementType() StatementType
StatementType implements the Statement interface.
type Tuple ¶
type Tuple Exprs
Tuple represents a parenthesized list of expressions.
func (Tuple) Eval ¶
func (t Tuple) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type UnaryExpr ¶
UnaryExpr represents a unary value expression.
func (*UnaryExpr) Eval ¶
func (expr *UnaryExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
type Union ¶
type Union struct { Type string Left, Right SelectStatement All bool }
Union represents a UNION statement.
func (*Union) StatementType ¶
func (*Union) StatementType() StatementType
StatementType implements the Statement interface.
type UniqueConstraint ¶
type UniqueConstraint struct{}
UniqueConstraint represents UNIQUE on a column.
type UniqueConstraintTableDef ¶
type UniqueConstraintTableDef struct { IndexTableDef PrimaryKey bool }
UniqueConstraintTableDef represents a unique constraint within a CREATE TABLE statement.
func (*UniqueConstraintTableDef) String ¶
func (node *UniqueConstraintTableDef) String() string
type Update ¶
type Update struct { Table TableExpr Exprs UpdateExprs Where *Where }
Update represents an UPDATE statement.
func (*Update) StatementType ¶
func (*Update) StatementType() StatementType
StatementType implements the Statement interface.
type UpdateExpr ¶
type UpdateExpr struct { Tuple bool Names QualifiedNames Expr Expr }
UpdateExpr represents an update expression.
func (*UpdateExpr) String ¶
func (node *UpdateExpr) String() string
type UpdateExprs ¶
type UpdateExprs []*UpdateExpr
UpdateExprs represents a list of update expressions.
func (UpdateExprs) String ¶
func (node UpdateExprs) String() string
type UserPriority ¶
type UserPriority int
UserPriority holds the user priority for a transaction.
const ( UnspecifiedUserPriority UserPriority = iota Low Normal High )
UserPriority values
func (UserPriority) String ¶
func (up UserPriority) String() string
type UsingJoinCond ¶
type UsingJoinCond struct {
Cols NameList
}
UsingJoinCond represents a USING join condition.
func (*UsingJoinCond) String ¶
func (node *UsingJoinCond) String() string
type ValArg ¶
type ValArg struct {
// contains filtered or unexported fields
}
ValArg represents a named bind var argument.
func (ValArg) Eval ¶
func (t ValArg) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
type Values ¶
type Values []Tuple
Values represents a VALUES clause.
func (Values) StatementType ¶
func (Values) StatementType() StatementType
StatementType implements the Statement interface.
type VariableExpr ¶
type VariableExpr interface { Expr Variable() }
VariableExpr is an Expr that may change per row. It is used to signal the evaluation/simplification machinery that the underlying Expr is not constant.
type Visitor ¶
The Visitor Visit method is invoked for each Expr node encountered by WalkExpr. The returned Expr replaces the pointer to the visited expression in the parent node and can be used for rewriting expressions. The pre argument indicates whether the visit is a pre-order or post-order visit. On a pre-order visit, if the result Visitor is nil children nodes are skipped from the traversal.
Source Files ¶
- alter_table.go
- builtins.go
- create.go
- datum.go
- delete.go
- drop.go
- encode.go
- eval.go
- explain.go
- expr.go
- grant.go
- indirection.go
- insert.go
- keywords.go
- name.go
- normalize.go
- parse.go
- regexp_cache.go
- rename.go
- reserved_keywords.go
- revoke.go
- scan.go
- select.go
- set.go
- show.go
- sql.y
- stmt.go
- syntax_string.go
- truncate.go
- txn.go
- type_check.go
- types.go
- union.go
- update.go
- values.go
- walk.go