Documentation
¶
Index ¶
- Constants
- Variables
- func FillArgs(stmt Statement, args Args) error
- func WalkStmt(v Visitor, stmt Statement)
- type AliasedTableExpr
- type AndExpr
- type Args
- type ArrayIndirection
- type BinaryExpr
- type BinaryOp
- type BitType
- type BlobType
- type BoolType
- type BoolVal
- type BytesVal
- type CaseExpr
- type CastExpr
- type CharType
- type ColumnConstraint
- type ColumnTableDef
- type ColumnType
- type ComparisonExpr
- type ComparisonOp
- type CreateDatabase
- type CreateTable
- type DBool
- type DFloat
- type DInt
- type DString
- type DTuple
- type DateType
- type Datum
- type DecimalType
- type Delete
- type DropDatabase
- type DropTable
- type ExistsExpr
- type Explain
- type Expr
- type Exprs
- type FloatType
- type FuncExpr
- type Grant
- type GroupBy
- type IndexIndirection
- type IndexTableDef
- type Indirection
- type IndirectionElem
- type Insert
- type IntType
- type IntVal
- type JoinCond
- type JoinTableExpr
- type Limit
- type Name
- type NameIndirection
- type NameList
- type NotExpr
- type NotNullConstraint
- type NullCheck
- type NullConstraint
- type NullVal
- type Nullability
- type NumVal
- type OnJoinCond
- type OrExpr
- type Order
- type OrderBy
- type ParenExpr
- type ParenSelect
- type ParenTableExpr
- type PrimaryKeyConstraint
- type PrivilegeList
- type PrivilegeType
- type QualifiedName
- func (n *QualifiedName) Column() string
- func (n *QualifiedName) Database() string
- 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
- type QualifiedNames
- type RangeCond
- type RenameDatabase
- type RenameTable
- type Revoke
- type Row
- type Select
- type SelectExpr
- type SelectExprs
- type SelectStatement
- type Set
- type ShowColumns
- type ShowDatabases
- type ShowGrants
- type ShowIndex
- type ShowTables
- type SimpleTableExpr
- type StarIndirection
- type Statement
- type StatementList
- type StrVal
- type Subquery
- type TableDef
- type TableDefs
- type TableExpr
- type TableExprs
- type TargetList
- type TargetType
- type TextType
- type TimeType
- type TimestampType
- type Truncate
- type Tuple
- type UnaryExpr
- type UnaryOp
- type Union
- type UniqueConstraint
- type Update
- type UpdateExpr
- type UpdateExprs
- type UsingJoinCond
- type ValArg
- type Values
- type Visitor
- type When
- type Where
Constants ¶
const ( TargetDatabase TargetType = iota PrivilegeAll PrivilegeType = iota PrivilegeRead PrivilegeWrite )
Enums for target and privilege types.
const ABORT = 57359
const ABSOLUTE = 57360
const ACCESS = 57361
const ACTION = 57362
const ADD = 57363
const ADMIN = 57364
const AFTER = 57365
const AGGREGATE = 57366
const ALL = 57367
const ALSO = 57368
const ALTER = 57369
const ALWAYS = 57370
const ANALYSE = 57371
const ANALYZE = 57372
const AND = 57373
const ANY = 57374
const ARRAY = 57375
const AS = 57376
const ASC = 57377
const ASSERTION = 57378
const ASSIGNMENT = 57379
const ASYMMETRIC = 57380
const AT = 57381
const ATTRIBUTE = 57382
const AUTHORIZATION = 57383
const BACKWARD = 57384
const BCONST = 57349
const BEFORE = 57385
const BEGIN = 57386
const BETWEEN = 57387
const BIGINT = 57388
const BINARY = 57389
const BIT = 57390
const BLOB = 57391
const BOOLEAN = 57392
const BOTH = 57393
const BY = 57394
const CACHE = 57395
const CALLED = 57396
const CASCADE = 57397
const CASCADED = 57398
const CASE = 57399
const CAST = 57400
const CHAIN = 57401
const CHAR = 57402
const CHARACTER = 57403
const CHARACTERISTICS = 57404
const CHECK = 57405
const CHECKPOINT = 57406
const CLASS = 57407
const CLOSE = 57408
const CLUSTER = 57409
const COALESCE = 57410
const COLLATE = 57411
const COLLATION = 57412
const COLUMN = 57413
const COLUMNS = 57414
const COMMENT = 57415
const COMMENTS = 57416
const COMMIT = 57417
const COMMITTED = 57418
const CONCAT = 57419
const CONCURRENTLY = 57420
const CONFIGURATION = 57421
const CONFLICT = 57422
const CONNECTION = 57423
const CONSTRAINT = 57424
const CONSTRAINTS = 57425
const CONTENT = 57426
const CONTINUE = 57427
const CONVERSION = 57428
const COPY = 57429
const COST = 57430
const CREATE = 57431
const CROSS = 57432
const CSV = 57433
const CUBE = 57434
const CURRENT = 57435
const CURRENT_CATALOG = 57436
const CURRENT_DATE = 57437
const CURRENT_ROLE = 57438
const CURRENT_TIME = 57439
const CURRENT_TIMESTAMP = 57440
const CURRENT_USER = 57441
const CURSOR = 57442
const CYCLE = 57443
const DATA = 57444
const DATABASE = 57445
const DATABASES = 57446
const DATE = 57447
const DAY = 57448
const DEALLOCATE = 57449
const DEC = 57450
const DECIMAL = 57451
const DECLARE = 57452
const DEFAULT = 57453
const DEFAULTS = 57454
const DEFERRABLE = 57455
const DEFERRED = 57456
const DEFINER = 57457
const DELETE = 57458
const DELIMITER = 57459
const DELIMITERS = 57460
const DESC = 57461
const DICTIONARY = 57462
const DISABLE = 57463
const DISCARD = 57464
const DISTINCT = 57465
const DO = 57466
const DOCUMENT = 57467
const DOMAIN = 57468
const DOT_DOT = 57354
const DOUBLE = 57469
const DROP = 57470
const EACH = 57471
const ELSE = 57472
const ENABLE = 57473
const ENCODING = 57474
const ENCRYPTED = 57475
const END = 57476
const ENUM = 57477
const ERROR = 57358
const ESCAPE = 57478
const EVENT = 57479
const EXCEPT = 57480
const EXCLUDE = 57481
const EXCLUDING = 57482
const EXCLUSIVE = 57483
const EXECUTE = 57484
const EXISTS = 57485
const EXPLAIN = 57486
const EXTENSION = 57487
const EXTERNAL = 57488
const EXTRACT = 57489
const FALSE = 57490
const FAMILY = 57491
const FCONST = 57347
const FETCH = 57492
const FILTER = 57493
const FIRST = 57494
const FLOAT = 57495
const FOLLOWING = 57496
const FOR = 57497
const FORCE = 57498
const FOREIGN = 57499
const FORWARD = 57500
const FREEZE = 57501
const FROM = 57502
const FULL = 57503
const FUNCTION = 57504
const FUNCTIONS = 57505
const GLOBAL = 57506
const GRANT = 57507
const GRANTED = 57508
const GRANTS = 57509
const GREATER_EQUALS = 57356
const GREATEST = 57510
const GROUP = 57511
const GROUPING = 57512
const HANDLER = 57513
const HAVING = 57514
const HEADER = 57515
const HOLD = 57516
const HOUR = 57517
const ICONST = 57351
const IDENT = 57346
const IDENTITY = 57518
const IF = 57519
const IMMEDIATE = 57520
const IMMUTABLE = 57521
const IMPLICIT = 57522
const IMPORT = 57523
const IN = 57524
const INCLUDING = 57525
const INCREMENT = 57526
const INDEX = 57527
const INDEXES = 57528
const INHERIT = 57529
const INHERITS = 57530
const INITIALLY = 57531
const INLINE = 57532
const INNER = 57533
const INOUT = 57534
const INPUT = 57535
const INSENSITIVE = 57536
const INSERT = 57537
const INSTEAD = 57538
const INT = 57539
const INTEGER = 57540
const INTERSECT = 57541
const INTERVAL = 57542
const INTO = 57543
const INVOKER = 57544
const IS = 57545
const ISOLATION = 57546
const JOIN = 57547
const KEY = 57548
const LABEL = 57549
const LANGUAGE = 57550
const LARGE = 57551
const LAST = 57552
const LATERAL = 57553
const LEADING = 57554
const LEAKPROOF = 57555
const LEAST = 57556
const LEFT = 57557
const LESS_EQUALS = 57355
const LEVEL = 57558
const LIKE = 57559
const LIMIT = 57560
const LISTEN = 57561
const LOAD = 57562
const LOCAL = 57563
const LOCALTIME = 57564
const LOCALTIMESTAMP = 57565
const LOCATION = 57566
const LOCK = 57567
const LOCKED = 57568
const LOGGED = 57569
const MAPPING = 57570
const MATCH = 57571
const MATERIALIZED = 57572
const MAXVALUE = 57573
const MINUTE = 57574
const MINVALUE = 57575
const MODE = 57576
const MONTH = 57577
const MOVE = 57578
const NAME = 57579
const NAMES = 57580
const NATIONAL = 57581
const NATURAL = 57582
const NCHAR = 57583
const NEXT = 57584
const NO = 57585
const NONE = 57586
const NOT = 57587
const NOTHING = 57588
const NOTIFY = 57589
const NOT_EQUALS = 57357
const NOT_LA = 57752
const NOWAIT = 57590
const NULL = 57591
const NULLIF = 57592
const NULLS = 57593
const NULLS_LA = 57753
const NUMERIC = 57594
const OBJECT = 57595
const OF = 57596
const OFF = 57597
const OFFSET = 57598
const OIDS = 57599
const ON = 57600
const ONLY = 57601
const OPTION = 57602
const OPTIONS = 57603
const OR = 57604
const ORDER = 57605
const ORDINALITY = 57606
const OUT = 57607
const OUTER = 57608
const OVER = 57609
const OVERLAPS = 57610
const OVERLAY = 57611
const OWNED = 57612
const OWNER = 57613
const PARAM = 57352
const PARSER = 57614
const PARTIAL = 57615
const PARTITION = 57616
const PASSING = 57617
const PASSWORD = 57618
const PLACING = 57619
const PLANS = 57620
const POLICY = 57621
const POSITION = 57622
const POSTFIXOP = 57755
const PRECEDING = 57623
const PRECISION = 57624
const PREPARE = 57626
const PREPARED = 57627
const PRESERVE = 57625
const PRIMARY = 57628
const PRIOR = 57629
const PRIVILEGES = 57630
const PROCEDURAL = 57631
const PROCEDURE = 57632
const PROGRAM = 57633
const QUOTE = 57634
const RANGE = 57635
const READ = 57636
const REAL = 57637
const REASSIGN = 57638
const RECHECK = 57639
const RECURSIVE = 57640
const REF = 57641
const REFERENCES = 57642
const REFRESH = 57643
const REINDEX = 57644
const RELATIVE = 57645
const RELEASE = 57646
const RENAME = 57647
const REPEATABLE = 57648
const REPLACE = 57649
const REPLICA = 57650
const RESET = 57651
const RESTART = 57652
const RESTRICT = 57653
const RETURNING = 57654
const RETURNS = 57655
const REVOKE = 57656
const RIGHT = 57657
const ROLLBACK = 57658
const ROLLUP = 57659
const ROW = 57660
const ROWS = 57661
const RULE = 57662
const SAVEPOINT = 57663
const SCONST = 57348
const SCROLL = 57664
const SEARCH = 57665
const SECOND = 57666
const SECURITY = 57667
const SELECT = 57668
const SEQUENCE = 57669
const SEQUENCES = 57670
const SERIALIZABLE = 57671
const SERVER = 57672
const SESSION = 57673
const SESSION_USER = 57674
const SET = 57675
const SETOF = 57677
const SETS = 57676
const SHARE = 57678
const SHOW = 57679
const SIMILAR = 57680
const SIMPLE = 57681
const SKIP = 57682
const SMALLINT = 57683
const SNAPSHOT = 57684
const SOME = 57685
const SQL = 57686
const STABLE = 57687
const STANDALONE = 57688
const START = 57689
const STATEMENT = 57690
const STATISTICS = 57691
const STDIN = 57692
const STDOUT = 57693
const STRICT = 57694
const STRIP = 57695
const SUBSTRING = 57696
const SYMMETRIC = 57697
const SYSID = 57698
const SYSTEM = 57699
const TABLE = 57700
const TABLES = 57701
const TEXT = 57702
const THEN = 57703
const TIME = 57704
const TIMESTAMP = 57705
const TO = 57706
const TRAILING = 57707
const TRANSACTION = 57708
const TRANSFORM = 57709
const TREAT = 57710
const TRIGGER = 57711
const TRIM = 57712
const TRUE = 57713
const TRUNCATE = 57714
const TRUSTED = 57715
const TYPE = 57716
const TYPECAST = 57353
const TYPES = 57717
const UMINUS = 57756
const UNBOUNDED = 57718
const UNCOMMITTED = 57719
const UNENCRYPTED = 57720
const UNION = 57721
const UNIQUE = 57722
const UNKNOWN = 57723
const UNLISTEN = 57724
const UNLOGGED = 57725
const UNTIL = 57726
const UPDATE = 57727
const USER = 57728
const USING = 57729
const VACUUM = 57730
const VALID = 57731
const VALIDATE = 57732
const VALUE = 57733
const VALUES = 57734
const VARCHAR = 57735
const VARIADIC = 57736
const VARYING = 57737
const VERBOSE = 57738
const VERSION = 57739
const WHEN = 57740
const WHERE = 57741
const WINDOW = 57742
const WITH = 57743
const WITHIN = 57744
const WITHOUT = 57745
const WITH_LA = 57754
const WORK = 57746
const WRAPPER = 57747
const WRITE = 57748
const XCONST = 57350
const YEAR = 57749
const YES = 57750
const ZONE = 57751
Variables ¶
var DNull = dNull{}
DNull is the NULL Datum.
var StarExpr = &QualifiedName{Indirect: Indirection{unqualifiedStar}}
StarExpr is a convenience variable that represents an unqualified "*".
var StarSelectExpr = SelectExpr{Expr: StarExpr}
StarSelectExpr is a convenience variable that represents an unqualified "*" in a select expression.
Functions ¶
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 Args ¶
Args defines the interface for retrieving arguments. Return false for the second return value if the argument cannot be found.
type ArrayIndirection ¶
ArrayIndirection represents "[<begin>:<end>]" in an indirection expression.
func (*ArrayIndirection) String ¶
func (a *ArrayIndirection) String() string
type BinaryExpr ¶
BinaryExpr represents a binary value expression.
func (*BinaryExpr) String ¶
func (node *BinaryExpr) String() string
type CastExpr ¶
type CastExpr struct { Expr Expr Type ColumnType }
CastExpr represents a CAST(expr AS type) expression.
type ColumnConstraint ¶
type ColumnConstraint interface {
// contains filtered or unexported methods
}
ColumnConstraint represents a constraint on a column.
type ColumnTableDef ¶
type ColumnTableDef struct { Name Name Type ColumnType Nullable Nullability PrimaryKey bool Unique bool }
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 ComparisonExpr ¶
type ComparisonExpr struct { Operator ComparisonOp Left, Right Expr }
ComparisonExpr represents a two-value comparison expression.
func (*ComparisonExpr) String ¶
func (node *ComparisonExpr) String() string
type ComparisonOp ¶
type ComparisonOp int
ComparisonOp represents a binary operator.
const ( EQ ComparisonOp = iota LT GT LE GE NE In NotIn Like NotLike )
ComparisonExpr.Operator
func (ComparisonOp) String ¶
func (i ComparisonOp) String() string
type CreateDatabase ¶
CreateDatabase represents a CREATE DATABASE statement.
func (*CreateDatabase) String ¶
func (node *CreateDatabase) String() string
type CreateTable ¶
type CreateTable struct { IfNotExists bool Table *QualifiedName Defs TableDefs }
CreateTable represents a CREATE TABLE statement.
func (*CreateTable) String ¶
func (node *CreateTable) String() string
type Datum ¶
A Datum holds either a bool, int64, float64, string or []Datum.
func EvalExpr ¶
EvalExpr 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.
type DecimalType ¶
DecimalType represents a DECIMAL or NUMERIC type.
func (*DecimalType) String ¶
func (node *DecimalType) String() string
type DropDatabase ¶
DropDatabase represents a DROP DATABASE statement.
func (*DropDatabase) String ¶
func (node *DropDatabase) String() string
type DropTable ¶
type DropTable struct { Names QualifiedNames IfExists bool }
DropTable represents a DROP TABLE statement.
type ExistsExpr ¶
type ExistsExpr struct {
Subquery *Subquery
}
ExistsExpr represents an EXISTS expression.
func (*ExistsExpr) String ¶
func (node *ExistsExpr) String() string
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 Distinct bool Exprs Exprs }
FuncExpr represents a function call.
type Grant ¶
type Grant struct { Privileges PrivilegeList Targets TargetList Grantees NameList }
Grant represents a GRANT statement.
type IndexIndirection ¶
type IndexIndirection Name
IndexIndirection represents ":<name>" in an indirection expression.
func (IndexIndirection) String ¶
func (n IndexIndirection) String() string
type IndexTableDef ¶
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.
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 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 NotNullConstraint ¶
type NotNullConstraint struct{}
NotNullConstraint represents NOT NULL on a column.
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 OnJoinCond ¶
type OnJoinCond struct {
Expr Expr
}
OnJoinCond represents an ON join condition.
func (*OnJoinCond) String ¶
func (node *OnJoinCond) String() string
type ParenExpr ¶
type ParenExpr struct {
Expr Expr
}
ParenExpr represents a parenthesized expression.
type ParenSelect ¶
type ParenSelect struct {
Select SelectStatement
}
ParenSelect represents a parenthesized SELECT/UNION/VALUES statement.
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 PrimaryKeyConstraint ¶
type PrimaryKeyConstraint struct{}
PrimaryKeyConstraint represents NULL on a column.
type PrivilegeList ¶
type PrivilegeList []PrivilegeType
PrivilegeList represents a list of privileges.
func (PrivilegeList) Join ¶
func (pl PrivilegeList) Join(sep string) string
Join returns the list of privilege names joined using `sep`. The default stringer uses `, `, but we want to be able to get a tight representation of the string.
func (PrivilegeList) String ¶
func (pl PrivilegeList) String() string
type PrivilegeType ¶
type PrivilegeType int
PrivilegeType represents the type of privilege.
func (PrivilegeType) String ¶
func (pt PrivilegeType) String() string
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 (*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) 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.
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 RenameDatabase ¶
RenameDatabase represents a RENAME DATABASE statement.
func (*RenameDatabase) String ¶
func (node *RenameDatabase) String() string
type RenameTable ¶
RenameTable represents a RENAME TABLE statement.
func (*RenameTable) String ¶
func (node *RenameTable) String() string
type Revoke ¶
type Revoke struct { Privileges PrivilegeList Targets TargetList Grantees NameList }
Revoke represents a REVOKE statements. PrivilegeList and TargetList are defined in grant.go
type Row ¶
type Row Exprs
Row represents a parenthesized list of expressions. Similar to Tuple except in how it is textually represented.
type Select ¶
type Select struct { Distinct string 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.
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 ShowColumns ¶
type ShowColumns struct {
Table *QualifiedName
}
ShowColumns represents a SHOW COLUMNS statement.
func (*ShowColumns) String ¶
func (node *ShowColumns) String() string
type ShowDatabases ¶
type ShowDatabases struct { }
ShowDatabases represents a SHOW DATABASES statement.
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) String ¶
func (node *ShowGrants) String() string
type ShowIndex ¶
type ShowIndex struct {
Table *QualifiedName
}
ShowIndex represents a SHOW INDEX statement.
type ShowTables ¶
type ShowTables struct {
Name *QualifiedName
}
ShowTables represents a SHOW TABLES statement.
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 StatementList ¶
type StatementList []Statement
StatementList is a list of statements.
func Parse ¶
func Parse(sql string) (StatementList, error)
Parse parses the sql and returns a list of statements.
func (StatementList) String ¶
func (l StatementList) String() string
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.
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.
type Union ¶
type Union struct { Type string Left, Right SelectStatement }
Union represents a UNION statement.
type UniqueConstraint ¶
type UniqueConstraint struct{}
UniqueConstraint represents UNIQUE on a column.
type Update ¶
type Update struct { Table TableExpr Exprs UpdateExprs Where *Where }
Update represents an UPDATE statement.
type UpdateExpr ¶
type UpdateExpr struct { Name *QualifiedName 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 UsingJoinCond ¶
type UsingJoinCond struct {
Cols NameList
}
UsingJoinCond represents a USING join condition.
func (*UsingJoinCond) String ¶
func (node *UsingJoinCond) String() string
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.