Documentation ¶
Index ¶
- Constants
- Variables
- func AsString(n NodeFormatter) string
- func AsStringWithFlags(n NodeFormatter, f FmtFlags) string
- func ContainsVars(expr Expr) bool
- func FormatNode(buf *bytes.Buffer, f FmtFlags, n NodeFormatter)
- func ProcessPlaceholderAnnotations(stmt Statement, args MapArgs) error
- func SimilarEscape(pattern string) string
- func ValidateRestartCheckpoint(savepoint string) error
- func WalkExprConst(v Visitor, expr Expr)
- type AliasClause
- type AliasedTableExpr
- type AlterTable
- type AlterTableAddColumn
- type AlterTableAddConstraint
- type AlterTableCmd
- type AlterTableCmds
- type AlterTableDropColumn
- type AlterTableDropConstraint
- type AlterTableDropNotNull
- type AlterTableSetDefault
- type AndExpr
- func (expr *AndExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *AndExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta AndExpr) ReturnType() Datum
- func (node *AndExpr) String() string
- func (expr *AndExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (node *AndExpr) TypedLeft() TypedExpr
- func (node *AndExpr) TypedRight() TypedExpr
- func (expr *AndExpr) Walk(v Visitor) Expr
- type AnyType
- type ArgTypes
- type Args
- type Array
- type ArrayIndirection
- type BeginTransaction
- type BinOp
- type BinaryExpr
- func (expr *BinaryExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *BinaryExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta BinaryExpr) ReturnType() Datum
- func (node *BinaryExpr) String() string
- func (expr *BinaryExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *BinaryExpr) Walk(v Visitor) Expr
- type BinaryOperator
- type BoolColType
- type Builtin
- type BytesColType
- type CaseExpr
- func (expr *CaseExpr) CopyNode() *CaseExpr
- func (expr *CaseExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *CaseExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta CaseExpr) ReturnType() Datum
- func (node *CaseExpr) String() string
- func (expr *CaseExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *CaseExpr) Walk(v Visitor) Expr
- type CastExpr
- func (expr *CastExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *CastExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta CastExpr) ReturnType() Datum
- func (node *CastExpr) String() string
- func (expr *CastExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *CastExpr) Walk(v Visitor) Expr
- type CheckConstraintTableDef
- type CmpOp
- type CoalesceExpr
- func (expr *CoalesceExpr) CopyNode() *CoalesceExpr
- func (expr *CoalesceExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *CoalesceExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta CoalesceExpr) ReturnType() Datum
- func (node *CoalesceExpr) String() string
- func (expr *CoalesceExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *CoalesceExpr) Walk(v Visitor) Expr
- type ColumnCheckConstraint
- type ColumnDefault
- type ColumnMutationCmd
- type ColumnQualification
- type ColumnTableDef
- type ColumnType
- type CommitTransaction
- type ComparisonExpr
- func (expr *ComparisonExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *ComparisonExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (node *ComparisonExpr) IsMixedTypeComparison() bool
- func (ta ComparisonExpr) ReturnType() Datum
- func (node *ComparisonExpr) String() string
- func (expr *ComparisonExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (node *ComparisonExpr) TypedLeft() TypedExpr
- func (node *ComparisonExpr) TypedRight() TypedExpr
- func (expr *ComparisonExpr) Walk(v Visitor) Expr
- type ComparisonOperator
- type Constant
- 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) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DBool) HasNext() bool
- func (*DBool) HasPrev() bool
- func (d *DBool) IsMax() bool
- func (d *DBool) IsMin() bool
- func (*DBool) Next() Datum
- func (*DBool) Prev() Datum
- func (*DBool) ReturnType() Datum
- func (node *DBool) String() string
- func (*DBool) Type() string
- func (d *DBool) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DBool) TypeEqual(other Datum) bool
- func (expr *DBool) Walk(_ Visitor) Expr
- type DBytes
- func (d *DBytes) Compare(other Datum) int
- func (t *DBytes) Eval(_ EvalContext) (Datum, error)
- func (d *DBytes) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DBytes) HasNext() bool
- func (*DBytes) HasPrev() bool
- func (*DBytes) IsMax() bool
- func (d *DBytes) IsMin() bool
- func (d *DBytes) Next() Datum
- func (d *DBytes) Prev() Datum
- func (d *DBytes) ReturnType() Datum
- func (node *DBytes) String() string
- func (*DBytes) Type() string
- func (d *DBytes) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DBytes) TypeEqual(other Datum) bool
- func (expr *DBytes) Walk(_ Visitor) Expr
- type DDate
- func (d *DDate) Compare(other Datum) int
- func (t *DDate) Eval(_ EvalContext) (Datum, error)
- func (d *DDate) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DDate) HasNext() bool
- func (*DDate) HasPrev() bool
- func (d *DDate) IsMax() bool
- func (d *DDate) IsMin() bool
- func (d *DDate) Next() Datum
- func (d *DDate) Prev() Datum
- func (*DDate) ReturnType() Datum
- func (node *DDate) String() string
- func (*DDate) Type() string
- func (d *DDate) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DDate) TypeEqual(other Datum) bool
- func (expr *DDate) Walk(_ Visitor) Expr
- type DDecimal
- func (d *DDecimal) Compare(other Datum) int
- func (t *DDecimal) Eval(_ EvalContext) (Datum, error)
- func (d *DDecimal) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DDecimal) HasNext() bool
- func (*DDecimal) HasPrev() bool
- func (*DDecimal) IsMax() bool
- func (*DDecimal) IsMin() bool
- func (d *DDecimal) Next() Datum
- func (d *DDecimal) Prev() Datum
- func (d *DDecimal) ReturnType() Datum
- func (node *DDecimal) String() string
- func (*DDecimal) Type() string
- func (d *DDecimal) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DDecimal) TypeEqual(other Datum) bool
- func (expr *DDecimal) Walk(_ Visitor) Expr
- type DFloat
- func (d *DFloat) Compare(other Datum) int
- func (t *DFloat) Eval(_ EvalContext) (Datum, error)
- func (d *DFloat) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DFloat) HasNext() bool
- func (*DFloat) HasPrev() bool
- func (d *DFloat) IsMax() bool
- func (d *DFloat) IsMin() bool
- func (d *DFloat) Next() Datum
- func (d *DFloat) Prev() Datum
- func (*DFloat) ReturnType() Datum
- func (node *DFloat) String() string
- func (*DFloat) Type() string
- func (d *DFloat) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DFloat) TypeEqual(other Datum) bool
- func (expr *DFloat) Walk(_ Visitor) Expr
- type DInt
- func (d *DInt) Compare(other Datum) int
- func (t *DInt) Eval(_ EvalContext) (Datum, error)
- func (d *DInt) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DInt) HasNext() bool
- func (*DInt) HasPrev() bool
- func (d *DInt) IsMax() bool
- func (d *DInt) IsMin() bool
- func (d *DInt) Next() Datum
- func (d *DInt) Prev() Datum
- func (*DInt) ReturnType() Datum
- func (node *DInt) String() string
- func (*DInt) Type() string
- func (d *DInt) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DInt) TypeEqual(other Datum) bool
- func (expr *DInt) Walk(_ Visitor) Expr
- type DInterval
- func (d *DInterval) Compare(other Datum) int
- func (t *DInterval) Eval(_ EvalContext) (Datum, error)
- func (d *DInterval) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DInterval) HasNext() bool
- func (*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) ReturnType() Datum
- func (node *DInterval) String() string
- func (*DInterval) Type() string
- func (d *DInterval) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DInterval) TypeEqual(other Datum) bool
- func (expr *DInterval) Walk(_ Visitor) Expr
- type DString
- func (d *DString) Compare(other Datum) int
- func (t *DString) Eval(_ EvalContext) (Datum, error)
- func (d *DString) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DString) HasNext() bool
- func (*DString) HasPrev() bool
- func (*DString) IsMax() bool
- func (d *DString) IsMin() bool
- func (d *DString) Next() Datum
- func (d *DString) Prev() Datum
- func (*DString) ReturnType() Datum
- func (node *DString) String() string
- func (*DString) Type() string
- func (d *DString) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DString) TypeEqual(other Datum) bool
- func (expr *DString) Walk(_ Visitor) Expr
- type DTimestamp
- func (d *DTimestamp) Compare(other Datum) int
- func (t *DTimestamp) Eval(_ EvalContext) (Datum, error)
- func (d *DTimestamp) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DTimestamp) HasNext() bool
- func (*DTimestamp) HasPrev() bool
- func (d *DTimestamp) IsMax() bool
- func (d *DTimestamp) IsMin() bool
- func (d *DTimestamp) Next() Datum
- func (d *DTimestamp) Prev() Datum
- func (*DTimestamp) ReturnType() Datum
- func (node *DTimestamp) String() string
- func (*DTimestamp) Type() string
- func (d *DTimestamp) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DTimestamp) TypeEqual(other Datum) bool
- func (expr *DTimestamp) Walk(_ Visitor) Expr
- type DTimestampTZ
- func (d *DTimestampTZ) Compare(other Datum) int
- func (t *DTimestampTZ) Eval(_ EvalContext) (Datum, error)
- func (d *DTimestampTZ) Format(buf *bytes.Buffer, f FmtFlags)
- func (d *DTimestampTZ) HasNext() bool
- func (d *DTimestampTZ) HasPrev() bool
- func (d *DTimestampTZ) IsMax() bool
- func (d *DTimestampTZ) IsMin() bool
- func (d *DTimestampTZ) Next() Datum
- func (d *DTimestampTZ) Prev() Datum
- func (*DTimestampTZ) ReturnType() Datum
- func (node *DTimestampTZ) String() string
- func (d *DTimestampTZ) Type() string
- func (d *DTimestampTZ) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DTimestampTZ) TypeEqual(other Datum) bool
- func (expr *DTimestampTZ) Walk(_ Visitor) Expr
- type DTuple
- func (d *DTuple) Compare(other Datum) int
- func (t *DTuple) Eval(_ EvalContext) (Datum, error)
- func (d *DTuple) Format(buf *bytes.Buffer, f FmtFlags)
- func (d *DTuple) HasNext() bool
- func (d *DTuple) HasPrev() bool
- func (*DTuple) IsMax() bool
- func (*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) ReturnType() Datum
- func (d *DTuple) SortedDifference(other *DTuple) *DTuple
- func (node *DTuple) String() string
- func (d *DTuple) Swap(i, j int)
- func (*DTuple) Type() string
- func (d *DTuple) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DTuple) TypeEqual(other Datum) bool
- func (expr *DTuple) Walk(_ Visitor) Expr
- type DValArg
- func (d *DValArg) Compare(other Datum) int
- func (t *DValArg) Eval(_ EvalContext) (Datum, error)
- func (d *DValArg) Format(buf *bytes.Buffer, f FmtFlags)
- func (*DValArg) HasNext() bool
- func (*DValArg) HasPrev() bool
- func (*DValArg) IsMax() bool
- func (*DValArg) IsMin() bool
- func (d *DValArg) Next() Datum
- func (d *DValArg) Prev() Datum
- func (d *DValArg) ReturnType() Datum
- func (node *DValArg) String() string
- func (*DValArg) Type() string
- func (d *DValArg) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (d *DValArg) TypeEqual(other Datum) bool
- func (*DValArg) Variable()
- func (expr *DValArg) Walk(_ Visitor) Expr
- type DateColType
- type Datum
- type DecimalColType
- type DefaultVal
- func (expr DefaultVal) Eval(_ EvalContext) (Datum, error)
- func (node DefaultVal) Format(buf *bytes.Buffer, f FmtFlags)
- func (DefaultVal) ReturnType() Datum
- func (node DefaultVal) String() string
- func (expr DefaultVal) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr DefaultVal) Walk(_ Visitor) Expr
- type Delete
- type Direction
- type DropBehavior
- type DropDatabase
- type DropIndex
- type DropTable
- type EvalContext
- func (ctx *EvalContext) GetClusterTimestamp() *DDecimal
- func (ctx EvalContext) GetLocation() *time.Location
- func (ctx *EvalContext) GetStmtTimestamp() *DTimestamp
- func (ctx *EvalContext) GetTxnTimestamp(precision time.Duration) *DTimestamp
- func (ctx EvalContext) NormalizeExpr(typedExpr TypedExpr) (TypedExpr, error)
- func (ctx EvalContext) ParseTimestamp(s DString, precision time.Duration) (*DTimestamp, error)
- func (ctx *EvalContext) SetClusterTimestamp(ts roachpb.Timestamp)
- func (ctx *EvalContext) SetStmtTimestamp(ts time.Time)
- func (ctx *EvalContext) SetTxnTimestamp(ts time.Time)
- type ExistsExpr
- func (t *ExistsExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *ExistsExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta ExistsExpr) ReturnType() Datum
- func (node *ExistsExpr) String() string
- func (expr *ExistsExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *ExistsExpr) Walk(v Visitor) Expr
- type Explain
- type Expr
- type Exprs
- type FloatColType
- type FmtFlags
- type FuncExpr
- func (expr *FuncExpr) CopyNode() *FuncExpr
- func (expr *FuncExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *FuncExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta FuncExpr) ReturnType() Datum
- func (node *FuncExpr) String() string
- func (expr *FuncExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *FuncExpr) Walk(v Visitor) Expr
- type Grant
- type GroupBy
- type IfExpr
- func (expr *IfExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *IfExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta IfExpr) ReturnType() Datum
- func (node *IfExpr) String() string
- func (expr *IfExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *IfExpr) Walk(v Visitor) Expr
- type IndexElem
- type IndexElemList
- type IndexHints
- type IndexTableDef
- type IndexedVar
- func (v *IndexedVar) Eval(ctx EvalContext) (Datum, error)
- func (v *IndexedVar) Format(buf *bytes.Buffer, f FmtFlags)
- func (v *IndexedVar) ReturnType() Datum
- func (node *IndexedVar) String() string
- func (v *IndexedVar) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (*IndexedVar) Variable()
- func (v *IndexedVar) Walk(_ Visitor) Expr
- type IndexedVarContainer
- type IndexedVarHelper
- type Indirection
- type IndirectionElem
- type Insert
- func (stmt *Insert) CopyNode() *Insert
- func (node *Insert) DefaultValues() bool
- func (node *Insert) Format(buf *bytes.Buffer, f FmtFlags)
- func (*Insert) StatementTag() string
- func (n *Insert) StatementType() StatementType
- func (n *Insert) String() string
- func (stmt *Insert) WalkStmt(v Visitor) Statement
- type IntColType
- type IntervalColType
- type IsOfTypeExpr
- func (expr *IsOfTypeExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *IsOfTypeExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta IsOfTypeExpr) ReturnType() Datum
- func (node *IsOfTypeExpr) String() string
- func (expr *IsOfTypeExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *IsOfTypeExpr) Walk(v Visitor) Expr
- type IsolationLevel
- type JoinCond
- type JoinTableExpr
- type Limit
- type MapArgs
- type Name
- type NameIndirection
- type NameList
- type NodeFormatter
- type NotExpr
- func (expr *NotExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *NotExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta NotExpr) ReturnType() Datum
- func (node *NotExpr) String() string
- func (expr *NotExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (node *NotExpr) TypedInnerExpr() TypedExpr
- func (expr *NotExpr) Walk(v Visitor) Expr
- type NotNullConstraint
- type NullConstraint
- type NullIfExpr
- func (expr *NullIfExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *NullIfExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta NullIfExpr) ReturnType() Datum
- func (node *NullIfExpr) String() string
- func (expr *NullIfExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *NullIfExpr) Walk(v Visitor) Expr
- type Nullability
- type NumVal
- func (expr *NumVal) AvailableTypes() []Datum
- func (expr *NumVal) Format(buf *bytes.Buffer, f FmtFlags)
- func (expr *NumVal) ResolveAsType(typ Datum) (Datum, error)
- func (node *NumVal) String() string
- func (expr *NumVal) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *NumVal) Walk(_ Visitor) Expr
- type OnConflict
- type OnJoinCond
- type OrExpr
- func (expr *OrExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *OrExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta OrExpr) ReturnType() Datum
- func (node *OrExpr) String() string
- func (expr *OrExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (node *OrExpr) TypedLeft() TypedExpr
- func (node *OrExpr) TypedRight() TypedExpr
- func (expr *OrExpr) Walk(v Visitor) Expr
- type Order
- type OrderBy
- type OverlayExpr
- type ParenExpr
- func (expr *ParenExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *ParenExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta ParenExpr) ReturnType() Datum
- func (node *ParenExpr) String() string
- func (expr *ParenExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (node *ParenExpr) TypedInnerExpr() TypedExpr
- func (expr *ParenExpr) Walk(v Visitor) Expr
- type ParenSelect
- type ParenTableExpr
- type Parser
- type PrimaryKeyConstraint
- type QualifiedName
- func (node *QualifiedName) ClearString()
- func (node *QualifiedName) Column() string
- func (node *QualifiedName) Database() string
- func (expr *QualifiedName) Eval(ctx EvalContext) (Datum, error)
- func (node *QualifiedName) Format(buf *bytes.Buffer, f FmtFlags)
- func (node *QualifiedName) IsStar() bool
- func (node *QualifiedName) NormalizeColumnName() error
- func (node *QualifiedName) NormalizeTableName(database string) error
- func (node *QualifiedName) QualifyWithDatabase(database string) error
- func (node *QualifiedName) ReturnType() Datum
- func (node *QualifiedName) String() string
- func (node *QualifiedName) Table() string
- func (expr *QualifiedName) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (*QualifiedName) Variable()
- func (expr *QualifiedName) Walk(_ Visitor) Expr
- type QualifiedNames
- type RangeCond
- func (expr *RangeCond) Eval(_ EvalContext) (Datum, error)
- func (node *RangeCond) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta RangeCond) ReturnType() Datum
- func (node *RangeCond) String() string
- func (expr *RangeCond) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (node *RangeCond) TypedFrom() TypedExpr
- func (node *RangeCond) TypedLeft() TypedExpr
- func (node *RangeCond) TypedTo() TypedExpr
- func (expr *RangeCond) Walk(v Visitor) Expr
- type RegexpCache
- type ReleaseSavepoint
- type RenameColumn
- type RenameDatabase
- type RenameIndex
- type RenameTable
- type ReturningExprs
- type Revoke
- type RollbackToSavepoint
- type RollbackTransaction
- type Savepoint
- type Select
- type SelectClause
- func (stmt *SelectClause) CopyNode() *SelectClause
- func (node *SelectClause) Format(buf *bytes.Buffer, f FmtFlags)
- func (*SelectClause) StatementTag() string
- func (*SelectClause) StatementType() StatementType
- func (n *SelectClause) String() string
- func (stmt *SelectClause) WalkStmt(v Visitor) Statement
- type SelectExpr
- type SelectExprs
- type SelectStatement
- type Set
- type SetDefaultIsolation
- type SetTimeZone
- type SetTransaction
- type Show
- type ShowColumns
- type ShowCreateTable
- type ShowDatabases
- type ShowGrants
- type ShowIndex
- type ShowTables
- type SimpleTableExpr
- type SimpleVisitFn
- type SingleType
- type StarIndirection
- type Statement
- type StatementList
- type StatementType
- type StrVal
- func (expr *StrVal) AvailableTypes() []Datum
- func (expr *StrVal) Format(buf *bytes.Buffer, f FmtFlags)
- func (expr *StrVal) ResolveAsType(typ Datum) (Datum, error)
- func (node *StrVal) String() string
- func (expr *StrVal) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *StrVal) Walk(_ Visitor) Expr
- type StringColType
- type Subquery
- func (expr *Subquery) Eval(_ EvalContext) (Datum, error)
- func (node *Subquery) Format(buf *bytes.Buffer, f FmtFlags)
- func (node *Subquery) ReturnType() Datum
- func (node *Subquery) String() string
- func (expr *Subquery) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *Subquery) Walk(v Visitor) Expr
- type Syntax
- type TableDef
- type TableDefs
- type TableExpr
- type TableExprs
- type TableNameWithIndex
- type TableNameWithIndexList
- type TargetList
- type TargetType
- type TimestampColType
- type TimestampTZColType
- type Truncate
- type Tuple
- type TypedExpr
- type TypedExprs
- type UnaryExpr
- func (expr *UnaryExpr) Eval(ctx EvalContext) (Datum, error)
- func (node *UnaryExpr) Format(buf *bytes.Buffer, f FmtFlags)
- func (ta UnaryExpr) ReturnType() Datum
- func (node *UnaryExpr) String() string
- func (expr *UnaryExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
- func (expr *UnaryExpr) Walk(v Visitor) Expr
- type UnaryOp
- type UnaryOperator
- type UnionClause
- type UnionType
- type UniqueConstraint
- type UniqueConstraintTableDef
- type Update
- type UpdateExpr
- type UpdateExprs
- type UserPriority
- type UsingJoinCond
- type ValArg
- type ValuesClause
- type VariableExpr
- type VariadicType
- type Visitor
- type WalkableStmt
- 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 = 57348
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 BYTEA = 57380
const BYTES = 57381
const CASCADE = 57382
const CASE = 57383
const CAST = 57384
const CHAR = 57385
const CHARACTER = 57386
const CHARACTERISTICS = 57387
const CHECK = 57388
const COALESCE = 57389
const COLLATE = 57390
const COLLATION = 57391
const COLUMN = 57392
const COLUMNS = 57393
const COMMIT = 57394
const COMMITTED = 57395
const CONCAT = 57396
const CONFLICT = 57397
const CONSTRAINT = 57398
const COVERING = 57399
const CREATE = 57400
const CROSS = 57401
const CUBE = 57402
const CURRENT = 57403
const CURRENT_CATALOG = 57404
const CURRENT_DATE = 57405
const CURRENT_ROLE = 57406
const CURRENT_TIME = 57407
const CURRENT_TIMESTAMP = 57408
const CURRENT_USER = 57409
const CYCLE = 57410
const DATA = 57411
const DATABASE = 57412
const DATABASES = 57413
const DATE = 57414
const DAY = 57415
const DEC = 57416
const DECIMAL = 57417
const DEFAULT = 57418
const DEFERRABLE = 57419
const DELETE = 57420
const DESC = 57421
const DISTINCT = 57422
const DO = 57423
const DOT_DOT = 57353
const DOUBLE = 57424
const DROP = 57425
const ELSE = 57426
const ENCODING = 57427
const END = 57428
const ERROR = 57357
const ESCAPE = 57429
const EXCEPT = 57430
const EXISTS = 57431
const EXPLAIN = 57432
const EXTRACT = 57433
const FALSE = 57434
const FCONST = 57350
const FETCH = 57435
const FILTER = 57436
const FIRST = 57437
const FLOAT = 57438
const FOLLOWING = 57439
const FOR = 57440
const FORCE_INDEX = 57441
const FOREIGN = 57442
const FROM = 57443
const FULL = 57444
const GRANT = 57445
const GRANTS = 57446
const GREATER_EQUALS = 57355
const GREATEST = 57447
const GROUP = 57448
const GROUPING = 57449
const HAVING = 57450
const HIGH = 57451
const HOUR = 57452
const ICONST = 57349
const IDENT = 57346
const IF = 57453
const IFNULL = 57454
const IN = 57455
const INDEX = 57456
const INDEXES = 57457
const INITIALLY = 57458
const INNER = 57459
const INSERT = 57460
const INT = 57461
const INT64 = 57462
const INTEGER = 57463
const INTERSECT = 57464
const INTERVAL = 57465
const INTO = 57466
const IS = 57467
const ISOLATION = 57468
const JOIN = 57469
const KEY = 57470
const KEYS = 57471
const LATERAL = 57472
const LEADING = 57473
const LEAST = 57474
const LEFT = 57475
const LESS_EQUALS = 57354
const LEVEL = 57476
const LIKE = 57477
const LIMIT = 57478
const LOCAL = 57479
const LOCALTIME = 57480
const LOCALTIMESTAMP = 57481
const LOW = 57482
const LSHIFT = 57483
const MATCH = 57484
const MINUTE = 57485
const MONTH = 57486
const NAME = 57487
const NAMES = 57488
const NATURAL = 57489
const NEXT = 57490
const NO = 57491
const NORMAL = 57493
const NOT = 57494
const NOTHING = 57495
const NOT_EQUALS = 57356
const NOT_LA = 57599
const NO_INDEX_JOIN = 57492
const NULL = 57496
const NULLIF = 57497
const NULLS = 57498
const NUMERIC = 57499
const OF = 57500
const OFF = 57501
const OFFSET = 57502
const ON = 57503
const ONLY = 57504
const OR = 57505
const ORDER = 57506
const ORDINALITY = 57507
const OUT = 57508
const OUTER = 57509
const OVER = 57510
const OVERLAPS = 57511
const OVERLAY = 57512
const PARAM = 57351
const PARTIAL = 57513
const PARTITION = 57514
const PLACING = 57515
const POSITION = 57516
const POSTFIXOP = 57601
const PRECEDING = 57517
const PRECISION = 57518
const PRIMARY = 57519
const PRIORITY = 57520
const RANGE = 57521
const READ = 57522
const REAL = 57523
const RECURSIVE = 57524
const REF = 57525
const REFERENCES = 57526
const RELEASE = 57529
const RENAME = 57527
const REPEATABLE = 57528
const RESTRICT = 57530
const RETURNING = 57531
const REVOKE = 57532
const RIGHT = 57533
const ROLLBACK = 57534
const ROLLUP = 57535
const ROW = 57536
const ROWS = 57537
const RSHIFT = 57538
const RestartSavepointName string = "COCKROACH_RESTART"
RestartSavepointName is the only savepoint name that we accept, modulo capitalization.
const SAVEPOINT = 57539
const SCONST = 57347
const SEARCH = 57540
const SECOND = 57541
const SELECT = 57542
const SERIALIZABLE = 57543
const SESSION = 57544
const SESSION_USER = 57545
const SET = 57546
const SHOW = 57547
const SIMILAR = 57548
const SIMPLE = 57549
const SMALLINT = 57550
const SNAPSHOT = 57551
const SOME = 57552
const SQL = 57553
const START = 57554
const STORING = 57557
const STRICT = 57555
const STRING = 57556
const SUBSTRING = 57558
const SYMMETRIC = 57559
const TABLE = 57560
const TABLES = 57561
const TEXT = 57562
const THEN = 57563
const TIME = 57564
const TIMESTAMP = 57565
const TIMESTAMPTZ = 57566
const TO = 57567
const TRAILING = 57568
const TRANSACTION = 57569
const TREAT = 57570
const TRIM = 57571
const TRUE = 57572
const TRUNCATE = 57573
const TYPE = 57574
const TYPECAST = 57352
const UMINUS = 57602
const UNBOUNDED = 57575
const UNCOMMITTED = 57576
const UNION = 57577
const UNIQUE = 57578
const UNKNOWN = 57579
const UPDATE = 57580
const UPSERT = 57581
const USER = 57582
const USING = 57583
const VALID = 57584
const VALIDATE = 57585
const VALUE = 57586
const VALUES = 57587
const VARCHAR = 57588
const VARIADIC = 57589
const VARYING = 57590
const WHEN = 57591
const WHERE = 57592
const WINDOW = 57593
const WITH = 57594
const WITHIN = 57595
const WITHOUT = 57596
const WITH_LA = 57600
const YEAR = 57597
const ZONE = 57598
Variables ¶
var ( // DBoolTrue is a pointer to the DBool(true) value and can be used in // comparisons against Datum types. DBoolTrue = &constDBoolTrue // DBoolFalse is a pointer to the DBool(false) value and can be used in // comparisons against Datum types. DBoolFalse = &constDBoolFalse // DNull is the NULL Datum. DNull Datum = dNull{} )
var BinOps = map[BinaryOperator]binOpOverload{ Bitand: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, }, Bitor: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, }, Bitxor: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, }, Plus: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, BinOp{ LeftType: TypeFloat, RightType: TypeFloat, ReturnType: TypeFloat, // contains filtered or unexported fields }, BinOp{ LeftType: TypeDecimal, RightType: TypeDecimal, ReturnType: TypeDecimal, // contains filtered or unexported fields }, BinOp{ LeftType: TypeDate, RightType: TypeInt, ReturnType: TypeDate, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInt, RightType: TypeDate, ReturnType: TypeDate, // contains filtered or unexported fields }, BinOp{ LeftType: TypeTimestamp, RightType: TypeInterval, ReturnType: TypeTimestamp, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInterval, RightType: TypeTimestamp, ReturnType: TypeTimestamp, // contains filtered or unexported fields }, BinOp{ LeftType: TypeTimestampTZ, RightType: TypeInterval, ReturnType: TypeTimestampTZ, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInterval, RightType: TypeTimestampTZ, ReturnType: TypeTimestampTZ, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInterval, RightType: TypeInterval, ReturnType: TypeInterval, // contains filtered or unexported fields }, }, Minus: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, BinOp{ LeftType: TypeFloat, RightType: TypeFloat, ReturnType: TypeFloat, // contains filtered or unexported fields }, BinOp{ LeftType: TypeDecimal, RightType: TypeDecimal, ReturnType: TypeDecimal, // contains filtered or unexported fields }, BinOp{ LeftType: TypeDate, RightType: TypeInt, ReturnType: TypeDate, // contains filtered or unexported fields }, BinOp{ LeftType: TypeDate, RightType: TypeDate, ReturnType: TypeInt, // contains filtered or unexported fields }, BinOp{ LeftType: TypeTimestamp, RightType: TypeTimestamp, ReturnType: TypeInterval, // contains filtered or unexported fields }, BinOp{ LeftType: TypeTimestampTZ, RightType: TypeTimestampTZ, ReturnType: TypeInterval, // contains filtered or unexported fields }, BinOp{ LeftType: TypeTimestamp, RightType: TypeInterval, ReturnType: TypeTimestamp, // contains filtered or unexported fields }, BinOp{ LeftType: TypeTimestampTZ, RightType: TypeInterval, ReturnType: TypeTimestampTZ, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInterval, RightType: TypeInterval, ReturnType: TypeInterval, // contains filtered or unexported fields }, }, Mult: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, BinOp{ LeftType: TypeFloat, RightType: TypeFloat, ReturnType: TypeFloat, // contains filtered or unexported fields }, BinOp{ LeftType: TypeFloat, RightType: TypeInt, ReturnType: TypeFloat, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInt, RightType: TypeFloat, ReturnType: TypeFloat, // contains filtered or unexported fields }, BinOp{ LeftType: TypeDecimal, RightType: TypeDecimal, ReturnType: TypeDecimal, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInt, RightType: TypeInterval, ReturnType: TypeInterval, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInterval, RightType: TypeInt, ReturnType: TypeInterval, // contains filtered or unexported fields }, }, Div: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeFloat, // contains filtered or unexported fields }, BinOp{ LeftType: TypeFloat, RightType: TypeFloat, ReturnType: TypeFloat, // contains filtered or unexported fields }, BinOp{ LeftType: TypeDecimal, RightType: TypeDecimal, ReturnType: TypeDecimal, // contains filtered or unexported fields }, BinOp{ LeftType: TypeInterval, RightType: TypeInt, ReturnType: TypeInterval, // contains filtered or unexported fields }, }, Mod: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, BinOp{ LeftType: TypeFloat, RightType: TypeFloat, ReturnType: TypeFloat, // contains filtered or unexported fields }, BinOp{ LeftType: TypeDecimal, RightType: TypeDecimal, ReturnType: TypeDecimal, // contains filtered or unexported fields }, }, Concat: { BinOp{ LeftType: TypeString, RightType: TypeString, ReturnType: TypeString, // contains filtered or unexported fields }, BinOp{ LeftType: TypeBytes, RightType: TypeBytes, ReturnType: TypeBytes, // contains filtered or unexported fields }, }, LShift: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, }, RShift: { BinOp{ LeftType: TypeInt, RightType: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, }, }
BinOps contains the binary operations indexed by operation type.
var Builtins = map[string][]Builtin{ "length": { stringBuiltin1(func(s string) (Datum, error) { return NewDInt(DInt(utf8.RuneCountInString(s))), nil }, TypeInt), bytesBuiltin1(func(s string) (Datum, error) { return NewDInt(DInt(len(s))), nil }, TypeInt), }, "octet_length": { stringBuiltin1(func(s string) (Datum, error) { return NewDInt(DInt(len(s))), nil }, TypeInt), bytesBuiltin1(func(s string) (Datum, error) { return NewDInt(DInt(len(s))), nil }, TypeInt), }, "lower": {stringBuiltin1(func(s string) (Datum, error) { return NewDString(strings.ToLower(s)), nil }, TypeString)}, "upper": {stringBuiltin1(func(s string) (Datum, error) { return NewDString(strings.ToUpper(s)), nil }, TypeString)}, "substr": substringImpls, "substring": substringImpls, "concat": { Builtin{ Types: VariadicType{TypeString}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "concat_ws": { Builtin{ Types: VariadicType{TypeString}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "split_part": { Builtin{ Types: ArgTypes{TypeString, TypeString, TypeInt}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "repeat": { Builtin{ Types: ArgTypes{TypeString, TypeInt}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "ascii": {stringBuiltin1(func(s string) (Datum, error) { for _, ch := range s { return NewDInt(DInt(ch)), nil } return nil, errEmptyInputString }, TypeInt)}, "md5": {stringBuiltin1(func(s string) (Datum, error) { return NewDString(fmt.Sprintf("%x", md5.Sum([]byte(s)))), nil }, TypeString)}, "sha1": {stringBuiltin1(func(s string) (Datum, error) { return NewDString(fmt.Sprintf("%x", sha1.Sum([]byte(s)))), nil }, TypeString)}, "sha256": {stringBuiltin1(func(s string) (Datum, error) { return NewDString(fmt.Sprintf("%x", sha256.Sum256([]byte(s)))), nil }, TypeString)}, "to_hex": { Builtin{ Types: ArgTypes{TypeInt}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "strpos": {stringBuiltin2(func(s, substring string) (Datum, error) { index := strings.Index(s, substring) if index < 0 { return NewDInt(0), nil } return NewDInt(DInt(utf8.RuneCountInString(s[:index]) + 1)), nil }, TypeInt)}, "overlay": { Builtin{ Types: ArgTypes{TypeString, TypeString, TypeInt}, ReturnType: TypeString, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeString, TypeString, TypeInt, TypeInt}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "btrim": { stringBuiltin2(func(s, chars string) (Datum, error) { return NewDString(strings.Trim(s, chars)), nil }, TypeString), stringBuiltin1(func(s string) (Datum, error) { return NewDString(strings.TrimSpace(s)), nil }, TypeString), }, "ltrim": { stringBuiltin2(func(s, chars string) (Datum, error) { return NewDString(strings.TrimLeft(s, chars)), nil }, TypeString), stringBuiltin1(func(s string) (Datum, error) { return NewDString(strings.TrimLeftFunc(s, unicode.IsSpace)), nil }, TypeString), }, "rtrim": { stringBuiltin2(func(s, chars string) (Datum, error) { return NewDString(strings.TrimRight(s, chars)), nil }, TypeString), stringBuiltin1(func(s string) (Datum, error) { return NewDString(strings.TrimRightFunc(s, unicode.IsSpace)), nil }, TypeString), }, "reverse": {stringBuiltin1(func(s string) (Datum, error) { runes := []rune(s) for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { runes[i], runes[j] = runes[j], runes[i] } return NewDString(string(runes)), nil }, TypeString)}, "replace": {stringBuiltin3(func(s, from, to string) (Datum, error) { return NewDString(strings.Replace(s, from, to, -1)), nil }, TypeString)}, "translate": {stringBuiltin3(func(s, from, to string) (Datum, error) { const deletionRune = utf8.MaxRune + 1 translation := make(map[rune]rune, len(from)) for _, fromRune := range from { toRune, size := utf8.DecodeRuneInString(to) if toRune == utf8.RuneError { toRune = deletionRune } else { to = to[size:] } translation[fromRune] = toRune } runes := make([]rune, 0, len(s)) for _, c := range s { if t, ok := translation[c]; ok { if t != deletionRune { runes = append(runes, t) } } else { runes = append(runes, c) } } return NewDString(string(runes)), nil }, TypeString)}, "regexp_extract": { Builtin{ Types: ArgTypes{TypeString, TypeString}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "regexp_replace": { Builtin{ Types: ArgTypes{TypeString, TypeString, TypeString}, ReturnType: TypeString, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeString, TypeString, TypeString, TypeString}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "initcap": {stringBuiltin1(func(s string) (Datum, error) { return NewDString(strings.Title(strings.ToLower(s))), nil }, TypeString)}, "left": { Builtin{ Types: ArgTypes{TypeBytes, TypeInt}, ReturnType: TypeBytes, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeString, TypeInt}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "right": { Builtin{ Types: ArgTypes{TypeBytes, TypeInt}, ReturnType: TypeBytes, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeString, TypeInt}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "random": { Builtin{ Types: ArgTypes{}, ReturnType: TypeFloat, // contains filtered or unexported fields }, }, "experimental_unique_bytes": { Builtin{ Types: ArgTypes{}, ReturnType: TypeBytes, // contains filtered or unexported fields }, }, "unique_rowid": { Builtin{ Types: ArgTypes{}, ReturnType: TypeInt, // contains filtered or unexported fields }, }, "experimental_uuid_v4": {uuidV4Impl}, "uuid_v4": {uuidV4Impl}, "greatest": { Builtin{ Types: AnyType{}, ReturnType: nil, // contains filtered or unexported fields }, }, "least": { Builtin{ Types: AnyType{}, ReturnType: nil, // contains filtered or unexported fields }, }, "age": { Builtin{ Types: ArgTypes{TypeTimestamp}, ReturnType: TypeInterval, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeTimestamp, TypeTimestamp}, ReturnType: TypeInterval, // contains filtered or unexported fields }, }, "current_date": { Builtin{ Types: ArgTypes{}, ReturnType: TypeDate, // contains filtered or unexported fields }, }, "now": {txnTSImpl}, "current_timestamp": {txnTSImpl}, "transaction_timestamp": {txnTSImpl}, "statement_timestamp": { Builtin{ Types: ArgTypes{}, ReturnType: TypeTimestamp, // contains filtered or unexported fields }, }, "cluster_logical_timestamp": { Builtin{ Types: ArgTypes{}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, }, "clock_timestamp": { Builtin{ Types: ArgTypes{}, ReturnType: TypeTimestamp, // contains filtered or unexported fields }, }, "extract": { Builtin{ Types: ArgTypes{TypeString, TypeTimestamp}, ReturnType: TypeInt, // contains filtered or unexported fields }, }, "parse_timestamp_ns": { Builtin{ Types: ArgTypes{TypeString}, ReturnType: TypeTimestamp, // contains filtered or unexported fields }, }, "format_timestamp_ns": { Builtin{ Types: ArgTypes{TypeTimestamp}, ReturnType: TypeString, // contains filtered or unexported fields }, }, "current_timestamp_ns": { Builtin{ Types: ArgTypes{}, ReturnType: TypeTimestamp, // contains filtered or unexported fields }, }, "avg": { Builtin{ Types: ArgTypes{TypeInt}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeFloat}, ReturnType: TypeFloat, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeDecimal}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, }, "bool_and": { Builtin{ Types: ArgTypes{TypeBool}, ReturnType: TypeBool, // contains filtered or unexported fields }, }, "bool_or": { Builtin{ Types: ArgTypes{TypeBool}, ReturnType: TypeBool, // contains filtered or unexported fields }, }, "count": countImpls(), "max": aggregateImpls(TypeBool, TypeInt, TypeFloat, TypeDecimal, TypeString, TypeBytes, TypeDate, TypeTimestamp, TypeInterval), "min": aggregateImpls(TypeBool, TypeInt, TypeFloat, TypeDecimal, TypeString, TypeBytes, TypeDate, TypeTimestamp, TypeInterval), "sum": { Builtin{ Types: ArgTypes{TypeInt}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeFloat}, ReturnType: TypeFloat, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeDecimal}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, }, "variance": { Builtin{ Types: ArgTypes{TypeInt}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeDecimal}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeFloat}, ReturnType: TypeFloat, // contains filtered or unexported fields }, }, "stddev": { Builtin{ Types: ArgTypes{TypeInt}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeDecimal}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeFloat}, ReturnType: TypeFloat, // contains filtered or unexported fields }, }, "abs": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Abs(x))), nil }), decimalBuiltin1(func(x *inf.Dec) (Datum, error) { dd := &DDecimal{} dd.Abs(x) return dd, nil }), Builtin{ Types: ArgTypes{TypeInt}, ReturnType: TypeInt, // contains filtered or unexported fields }, }, "acos": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Acos(x))), nil }), }, "asin": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Asin(x))), nil }), }, "atan": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Atan(x))), nil }), }, "atan2": { floatBuiltin2(func(x, y float64) (Datum, error) { return NewDFloat(DFloat(math.Atan2(x, y))), nil }), }, "cbrt": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Cbrt(x))), nil }), decimalBuiltin1(func(x *inf.Dec) (Datum, error) { dd := &DDecimal{} decimal.Cbrt(&dd.Dec, x, decimal.Precision) return dd, nil }), }, "ceil": ceilImpl, "ceiling": ceilImpl, "cos": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Cos(x))), nil }), }, "cot": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(1 / math.Tan(x))), nil }), }, "degrees": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(180.0 * x / math.Pi)), nil }), }, "div": { floatBuiltin2(func(x, y float64) (Datum, error) { return NewDFloat(DFloat(math.Trunc(x / y))), nil }), decimalBuiltin2(func(x, y *inf.Dec) (Datum, error) { if y.Sign() == 0 { return nil, errDivByZero } dd := &DDecimal{} dd.QuoRound(x, y, 0, inf.RoundDown) return dd, nil }), }, "exp": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Exp(x))), nil }), decimalBuiltin1(func(x *inf.Dec) (Datum, error) { dd := &DDecimal{} decimal.Exp(&dd.Dec, x, decimal.Precision) return dd, nil }), }, "floor": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Floor(x))), nil }), decimalBuiltin1(func(x *inf.Dec) (Datum, error) { dd := &DDecimal{} dd.Round(x, 0, inf.RoundFloor) return dd, nil }), }, "ln": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Log(x))), nil }), decimalLogFn(decimal.Log), }, "log": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Log10(x))), nil }), decimalLogFn(decimal.Log10), }, "mod": { floatBuiltin2(func(x, y float64) (Datum, error) { return NewDFloat(DFloat(math.Mod(x, y))), nil }), decimalBuiltin2(func(x, y *inf.Dec) (Datum, error) { if y.Sign() == 0 { return nil, errZeroModulus } dd := &DDecimal{} decimal.Mod(&dd.Dec, x, y) return dd, nil }), Builtin{ Types: ArgTypes{TypeInt, TypeInt}, ReturnType: TypeInt, // contains filtered or unexported fields }, }, "pi": { Builtin{ Types: ArgTypes{}, ReturnType: TypeFloat, // contains filtered or unexported fields }, }, "pow": powImpls, "power": powImpls, "radians": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(x * math.Pi / 180.0)), nil }), }, "round": { floatBuiltin1(func(x float64) (Datum, error) { return round(x, 0) }), decimalBuiltin1(func(x *inf.Dec) (Datum, error) { dd := &DDecimal{} dd.Round(x, 0, inf.RoundHalfUp) return dd, nil }), Builtin{ Types: ArgTypes{TypeFloat, TypeInt}, ReturnType: TypeFloat, // contains filtered or unexported fields }, Builtin{ Types: ArgTypes{TypeDecimal, TypeInt}, ReturnType: TypeDecimal, // contains filtered or unexported fields }, }, "sin": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Sin(x))), nil }), }, "sign": { floatBuiltin1(func(x float64) (Datum, error) { switch { case x < 0: return NewDFloat(-1), nil case x == 0: return NewDFloat(0), nil } return NewDFloat(1), nil }), decimalBuiltin1(func(x *inf.Dec) (Datum, error) { return NewDFloat(DFloat(x.Sign())), nil }), Builtin{ Types: ArgTypes{TypeInt}, ReturnType: TypeInt, // contains filtered or unexported fields }, }, "sqrt": { floatBuiltin1(func(x float64) (Datum, error) { if x < 0 { return nil, errSqrtOfNegNumber } return NewDFloat(DFloat(math.Sqrt(x))), nil }), decimalBuiltin1(func(x *inf.Dec) (Datum, error) { if x.Sign() < 0 { return nil, errSqrtOfNegNumber } dd := &DDecimal{} decimal.Sqrt(&dd.Dec, x, decimal.Precision) return dd, nil }), }, "tan": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Tan(x))), nil }), }, "trunc": { floatBuiltin1(func(x float64) (Datum, error) { return NewDFloat(DFloat(math.Trunc(x))), nil }), decimalBuiltin1(func(x *inf.Dec) (Datum, error) { dd := &DDecimal{} dd.Round(x, 0, inf.RoundDown) return dd, nil }), }, "version": { Builtin{ Types: ArgTypes{}, ReturnType: TypeString, // contains filtered or unexported fields }, }, }
Builtins contains the built-in functions indexed by name.
var CmpOps = map[ComparisonOperator]cmpOpOverload{ EQ: { CmpOp{ LeftType: TypeString, RightType: TypeString, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeBytes, RightType: TypeBytes, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeBool, RightType: TypeBool, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDate, RightType: TypeDate, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTimestamp, RightType: TypeTimestamp, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTimestampTZ, RightType: TypeTimestampTZ, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInterval, RightType: TypeInterval, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTuple, RightType: TypeTuple, // contains filtered or unexported fields }, }, LT: { CmpOp{ LeftType: TypeString, RightType: TypeString, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeBytes, RightType: TypeBytes, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeBool, RightType: TypeBool, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDate, RightType: TypeDate, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTimestamp, RightType: TypeTimestamp, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTimestampTZ, RightType: TypeTimestampTZ, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInterval, RightType: TypeInterval, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTuple, RightType: TypeTuple, // contains filtered or unexported fields }, }, LE: { CmpOp{ LeftType: TypeString, RightType: TypeString, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeBytes, RightType: TypeBytes, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeBool, RightType: TypeBool, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeInt, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInt, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDecimal, RightType: TypeFloat, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeFloat, RightType: TypeDecimal, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeDate, RightType: TypeDate, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTimestamp, RightType: TypeTimestamp, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTimestampTZ, RightType: TypeTimestampTZ, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeInterval, RightType: TypeInterval, // contains filtered or unexported fields }, CmpOp{ LeftType: TypeTuple, RightType: TypeTuple, // contains filtered or unexported fields }, }, In: { makeEvalTupleIn(TypeBool), makeEvalTupleIn(TypeInt), makeEvalTupleIn(TypeFloat), makeEvalTupleIn(TypeString), makeEvalTupleIn(TypeBytes), makeEvalTupleIn(TypeDate), makeEvalTupleIn(TypeTimestamp), makeEvalTupleIn(TypeTimestampTZ), makeEvalTupleIn(TypeInterval), makeEvalTupleIn(TypeTuple), }, Like: { CmpOp{ LeftType: TypeString, RightType: TypeString, // contains filtered or unexported fields }, }, SimilarTo: { CmpOp{ LeftType: TypeString, RightType: TypeString, // contains filtered or unexported fields }, }, }
CmpOps contains the comparison operations indexed by operation type.
var NoTypePreference = Datum(nil)
NoTypePreference can be provided to TypeCheck's desired type parameter to indicate that the caller of the function has no preference on the type of the resulting TypedExpr.
var UnaryOps = map[UnaryOperator]unaryOpOverload{ UnaryPlus: { UnaryOp{ Typ: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, UnaryOp{ Typ: TypeFloat, ReturnType: TypeFloat, // contains filtered or unexported fields }, UnaryOp{ Typ: TypeDecimal, ReturnType: TypeDecimal, // contains filtered or unexported fields }, }, UnaryMinus: { UnaryOp{ Typ: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, UnaryOp{ Typ: TypeFloat, ReturnType: TypeFloat, // contains filtered or unexported fields }, UnaryOp{ Typ: TypeDecimal, ReturnType: TypeDecimal, // contains filtered or unexported fields }, }, UnaryComplement: { UnaryOp{ Typ: TypeInt, ReturnType: TypeInt, // contains filtered or unexported fields }, }, }
UnaryOps contains the unary operations indexed by operation type.
Functions ¶
func AsStringWithFlags ¶
func AsStringWithFlags(n NodeFormatter, f FmtFlags) string
AsStringWithFlags pretty prints a node to a string given specific flags.
func ContainsVars ¶
ContainsVars returns true if the expression contains any variables.
func FormatNode ¶
func FormatNode(buf *bytes.Buffer, f FmtFlags, n NodeFormatter)
FormatNode recurses into a node for pretty-printing. Flag-driven special cases can hook into this.
func ProcessPlaceholderAnnotations ¶
ProcessPlaceholderAnnotations performs an order-independent global traversal of the provided Statement, annotating all placeholders with a type in either of the following situations.
- the placeholder is the subject of an explicit type annotation in at least one of its occurrences. If it is subject to multiple explicit type annotations where the types are not all in agreement, and error will be thrown.
- the placeholder is the subject to an implicit type annotation, meaning that it is not subject to an explicit type annotation, and that in all occurrences of the placeholder, it is subject to a cast to the same type. If it is subject to casts of multiple types, no error will be thrown, but the placeholder will not be annotated.
TODO(nvanbenschoten) Add support for explicit placeholder annotations. TODO(nvanbenschoten) Can this visitor and map be preallocated (like normalizeVisitor)?
func SimilarEscape ¶
SimilarEscape converts a SQL:2008 regexp pattern to POSIX style, so it can be used by our regexp engine.
func ValidateRestartCheckpoint ¶
ValidateRestartCheckpoint checks that a checkpoint name is our magic restart value. We accept everything with the desired prefix because at least the C++ libpqxx appends sequence numbers to the savepoint name specified by the user.
func WalkExprConst ¶
WalkExprConst is a variant of WalkExpr for visitors that do not modify the expression.
Types ¶
type AliasClause ¶
AliasClause represents an alias, optionally with a column list: "AS name" or "AS name(col1, col2)".
type AliasedTableExpr ¶
type AliasedTableExpr struct { Expr SimpleTableExpr Hints *IndexHints As AliasClause }
AliasedTableExpr represents a table expression coupled with an optional alias.
func (*AliasedTableExpr) Format ¶
func (node *AliasedTableExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
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) Format ¶
func (node *AlterTable) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*AlterTable) StatementTag ¶
func (*AlterTable) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*AlterTable) StatementType ¶
func (*AlterTable) StatementType() StatementType
StatementType implements the Statement interface.
func (*AlterTable) String ¶
func (n *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) Format ¶
func (node *AlterTableAddColumn) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*AlterTableAddColumn) String ¶
func (n *AlterTableAddColumn) String() string
type AlterTableAddConstraint ¶
type AlterTableAddConstraint struct {
ConstraintDef ConstraintTableDef
}
AlterTableAddConstraint represents an ADD CONSTRAINT command.
func (*AlterTableAddConstraint) Format ¶
func (node *AlterTableAddConstraint) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*AlterTableAddConstraint) String ¶
func (n *AlterTableAddConstraint) String() string
type AlterTableCmd ¶
type AlterTableCmd interface { NodeFormatter // 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) Format ¶
func (node AlterTableCmds) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (AlterTableCmds) String ¶
func (n AlterTableCmds) String() string
type AlterTableDropColumn ¶
type AlterTableDropColumn struct { IfExists bool Column string DropBehavior DropBehavior // contains filtered or unexported fields }
AlterTableDropColumn represents a DROP COLUMN command.
func (*AlterTableDropColumn) Format ¶
func (node *AlterTableDropColumn) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*AlterTableDropColumn) String ¶
func (n *AlterTableDropColumn) String() string
type AlterTableDropConstraint ¶
type AlterTableDropConstraint struct { IfExists bool Constraint string DropBehavior DropBehavior }
AlterTableDropConstraint represents a DROP CONSTRAINT command.
func (*AlterTableDropConstraint) Format ¶
func (node *AlterTableDropConstraint) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*AlterTableDropConstraint) String ¶
func (n *AlterTableDropConstraint) String() string
type AlterTableDropNotNull ¶
type AlterTableDropNotNull struct { Column string // contains filtered or unexported fields }
AlterTableDropNotNull represents an ALTER COLUMN DROP NOT NULL command.
func (*AlterTableDropNotNull) Format ¶
func (node *AlterTableDropNotNull) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*AlterTableDropNotNull) GetColumn ¶
func (node *AlterTableDropNotNull) GetColumn() string
GetColumn implements the ColumnMutationCmd interface.
func (*AlterTableDropNotNull) String ¶
func (n *AlterTableDropNotNull) String() string
type AlterTableSetDefault ¶
type AlterTableSetDefault struct { Column string Default Expr // contains filtered or unexported fields }
AlterTableSetDefault represents an ALTER COLUMN SET DEFAULT or DROP DEFAULT command.
func (*AlterTableSetDefault) Format ¶
func (node *AlterTableSetDefault) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*AlterTableSetDefault) GetColumn ¶
func (node *AlterTableSetDefault) GetColumn() string
GetColumn implements the ColumnMutationCmd interface.
func (*AlterTableSetDefault) String ¶
func (n *AlterTableSetDefault) String() string
type AndExpr ¶
type AndExpr struct {
Left, Right Expr
// contains filtered or unexported fields
}
AndExpr represents an AND expression.
func NewTypedAndExpr ¶
NewTypedAndExpr returns a new AndExpr that is verified to be well-typed.
func (*AndExpr) Eval ¶
func (expr *AndExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (AndExpr) ReturnType ¶
func (ta AndExpr) ReturnType() Datum
func (*AndExpr) TypedRight ¶
TypedRight returns the AndExpr's right expression as a TypedExpr.
type AnyType ¶
type AnyType struct{}
AnyType is a typeList implementation that accepts any arguments.
type ArgTypes ¶
type ArgTypes []Datum
ArgTypes is a typeList implementation that accepts a specific number of argument types.
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 struct {
Exprs Exprs
}
Array represents an array constructor.
type ArrayIndirection ¶
ArrayIndirection represents "[<begin>:<end>]" in an indirection expression.
type BeginTransaction ¶
type BeginTransaction struct { Isolation IsolationLevel UserPriority UserPriority }
BeginTransaction represents a BEGIN statement
func (*BeginTransaction) Format ¶
func (node *BeginTransaction) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*BeginTransaction) StatementTag ¶
func (*BeginTransaction) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*BeginTransaction) StatementType ¶
func (*BeginTransaction) StatementType() StatementType
StatementType implements the Statement interface.
func (*BeginTransaction) String ¶
func (n *BeginTransaction) String() string
type BinOp ¶
type BinOp struct { LeftType Datum RightType Datum ReturnType Datum // contains filtered or unexported fields }
BinOp is a binary operator.
type BinaryExpr ¶
type BinaryExpr struct { Operator BinaryOperator 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) Format ¶
func (node *BinaryExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (BinaryExpr) ReturnType ¶
func (ta BinaryExpr) ReturnType() Datum
func (*BinaryExpr) String ¶
func (node *BinaryExpr) String() string
func (*BinaryExpr) TypeCheck ¶
func (expr *BinaryExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface.
func (*BinaryExpr) Walk ¶
func (expr *BinaryExpr) Walk(v Visitor) Expr
Walk implements the Expr interface.
type BinaryOperator ¶
type BinaryOperator int
BinaryOperator represents a binary operator.
const ( Bitand BinaryOperator = iota Bitor Bitxor Plus Minus Mult Div Mod Concat LShift RShift )
BinaryExpr.Operator
func (BinaryOperator) String ¶
func (i BinaryOperator) String() string
type BoolColType ¶
type BoolColType struct {
Name string
}
BoolColType represents a BOOLEAN type.
func (*BoolColType) Format ¶
func (node *BoolColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*BoolColType) String ¶
func (node *BoolColType) String() string
type Builtin ¶
type Builtin struct { Types typeList ReturnType Datum // contains filtered or unexported fields }
Builtin is a built-in function.
type BytesColType ¶
type BytesColType struct {
Name string
}
BytesColType represents a BYTES or BLOB type.
func (*BytesColType) Format ¶
func (node *BytesColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*BytesColType) String ¶
func (node *BytesColType) String() string
type CaseExpr ¶
type CaseExpr struct { Expr Expr Whens []*When Else Expr // contains filtered or unexported fields }
CaseExpr represents a CASE expression.
func (*CaseExpr) CopyNode ¶
CopyNode makes a copy of this Expr without recursing in any child Exprs.
func (*CaseExpr) Eval ¶
func (expr *CaseExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (CaseExpr) ReturnType ¶
func (ta CaseExpr) ReturnType() Datum
type CastExpr ¶
type CastExpr struct { Expr Expr Type ColumnType // contains filtered or unexported fields }
CastExpr represents a CAST(expr AS type) expression.
func (*CastExpr) Eval ¶
func (expr *CastExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (CastExpr) ReturnType ¶
func (ta CastExpr) ReturnType() Datum
type CheckConstraintTableDef ¶
CheckConstraintTableDef represents a check constraint within a CREATE TABLE statement.
type CoalesceExpr ¶
CoalesceExpr represents a COALESCE or IFNULL expression.
func (*CoalesceExpr) CopyNode ¶
func (expr *CoalesceExpr) CopyNode() *CoalesceExpr
CopyNode makes a copy of this Expr without recursing in any child Exprs.
func (*CoalesceExpr) Eval ¶
func (expr *CoalesceExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*CoalesceExpr) Format ¶
func (node *CoalesceExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (CoalesceExpr) ReturnType ¶
func (ta CoalesceExpr) ReturnType() Datum
func (*CoalesceExpr) String ¶
func (node *CoalesceExpr) String() string
func (*CoalesceExpr) TypeCheck ¶
func (expr *CoalesceExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface.
func (*CoalesceExpr) Walk ¶
func (expr *CoalesceExpr) Walk(v Visitor) Expr
Walk implements the Expr interface.
type ColumnCheckConstraint ¶
type ColumnCheckConstraint struct {
Expr Expr
}
ColumnCheckConstraint represents either a check on a column.
type ColumnDefault ¶
type ColumnDefault struct {
Expr Expr
}
ColumnDefault represents a DEFAULT clause for a column.
type ColumnMutationCmd ¶
type ColumnMutationCmd interface { AlterTableCmd GetColumn() string }
ColumnMutationCmd is the subset of AlterTableCmds that modify an existing 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 CheckExpr Expr }
ColumnTableDef represents a column definition within a CREATE TABLE statement.
type ColumnType ¶
type ColumnType interface { fmt.Stringer NodeFormatter // contains filtered or unexported methods }
ColumnType represents a type in a column definition.
type CommitTransaction ¶
type CommitTransaction struct{}
CommitTransaction represents a COMMIT statement.
func (*CommitTransaction) Format ¶
func (node *CommitTransaction) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*CommitTransaction) StatementTag ¶
func (*CommitTransaction) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*CommitTransaction) StatementType ¶
func (*CommitTransaction) StatementType() StatementType
StatementType implements the Statement interface.
func (*CommitTransaction) String ¶
func (n *CommitTransaction) String() string
type ComparisonExpr ¶
type ComparisonExpr struct { Operator ComparisonOperator Left, Right Expr // contains filtered or unexported fields }
ComparisonExpr represents a two-value comparison expression.
func NewTypedComparisonExpr ¶
func NewTypedComparisonExpr(op ComparisonOperator, left, right TypedExpr) *ComparisonExpr
NewTypedComparisonExpr returns a new ComparisonExpr that is verified to be well-typed.
func (*ComparisonExpr) Eval ¶
func (expr *ComparisonExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*ComparisonExpr) Format ¶
func (node *ComparisonExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*ComparisonExpr) IsMixedTypeComparison ¶
func (node *ComparisonExpr) IsMixedTypeComparison() bool
IsMixedTypeComparison returns true when the two sides of a comparison operator have different types.
func (ComparisonExpr) ReturnType ¶
func (ta ComparisonExpr) ReturnType() Datum
func (*ComparisonExpr) String ¶
func (node *ComparisonExpr) String() string
func (*ComparisonExpr) TypeCheck ¶
func (expr *ComparisonExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface.
func (*ComparisonExpr) TypedLeft ¶
func (node *ComparisonExpr) TypedLeft() TypedExpr
TypedLeft returns the ComparisonExpr's left expression as a TypedExpr.
func (*ComparisonExpr) TypedRight ¶
func (node *ComparisonExpr) TypedRight() TypedExpr
TypedRight returns the ComparisonExpr's right expression as a TypedExpr.
func (*ComparisonExpr) Walk ¶
func (expr *ComparisonExpr) Walk(v Visitor) Expr
Walk implements the Expr interface.
type ComparisonOperator ¶
type ComparisonOperator int
ComparisonOperator represents a binary operator.
const ( EQ ComparisonOperator = iota LT GT LE GE NE In NotIn Like NotLike SimilarTo NotSimilarTo IsDistinctFrom IsNotDistinctFrom Is IsNot )
ComparisonExpr.Operator
func (ComparisonOperator) String ¶
func (i ComparisonOperator) String() string
type Constant ¶
type Constant interface { Expr // AvailableTypes returns the ordered set of types that the Constant is able to // be resolved into. The order of the type slice provides a notion of precedence, // with the first element in the ordering being the Constant's "natural type". AvailableTypes() []Datum // ResolveAsType resolves the Constant as the Datum type specified, or returns an // error if the Constant could not be resolved as that type. The method should only // be passed a type returned from AvailableTypes and should never be called more than // once for a given Constant. ResolveAsType(Datum) (Datum, error) }
Constant is an constant literal expression which may be resolved to more than one type.
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) Format ¶
func (node *CreateDatabase) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*CreateDatabase) StatementTag ¶
func (*CreateDatabase) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*CreateDatabase) StatementType ¶
func (*CreateDatabase) StatementType() StatementType
StatementType implements the Statement interface.
func (*CreateDatabase) String ¶
func (n *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) Format ¶
func (node *CreateIndex) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*CreateIndex) StatementTag ¶
func (*CreateIndex) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*CreateIndex) StatementType ¶
func (*CreateIndex) StatementType() StatementType
StatementType implements the Statement interface.
func (*CreateIndex) String ¶
func (n *CreateIndex) String() string
type CreateTable ¶
type CreateTable struct { IfNotExists bool Table *QualifiedName Defs TableDefs }
CreateTable represents a CREATE TABLE statement.
func (*CreateTable) Format ¶
func (node *CreateTable) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*CreateTable) StatementTag ¶
func (*CreateTable) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*CreateTable) StatementType ¶
func (*CreateTable) StatementType() StatementType
StatementType implements the Statement interface.
func (*CreateTable) String ¶
func (n *CreateTable) String() string
type DBool ¶
type DBool bool
DBool is the boolean Datum.
func MakeDBool ¶
MakeDBool converts its argument to a *DBool, returning either DBoolTrue or DBoolFalse.
func (*DBool) Eval ¶
func (t *DBool) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*DBool) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DBool) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
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.
func (*DBytes) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DBytes) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
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.
func (*DDate) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DDate) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
type DDecimal ¶
type DDecimal struct {
inf.Dec
}
DDecimal is the decimal Datum.
func (*DDecimal) Eval ¶
func (t *DDecimal) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*DDecimal) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DDecimal) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
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.
func (*DFloat) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DFloat) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
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.
func (*DInt) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DInt) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
type DInterval ¶
DInterval is the interval Datum.
func (*DInterval) Eval ¶
func (t *DInterval) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*DInterval) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DInterval) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
type DString ¶
type DString string
DString is the string Datum.
func NewDString ¶
NewDString is a helper routine to create a *DString initialized from its argument.
func (*DString) Eval ¶
func (t *DString) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*DString) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DString) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
type DTimestamp ¶
DTimestamp is the timestamp Datum.
func MakeDTimestamp ¶
func MakeDTimestamp(t time.Time, precision time.Duration) *DTimestamp
MakeDTimestamp creates a DTimestamp with specified precision.
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) Format ¶
func (d *DTimestamp) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*DTimestamp) HasNext ¶
func (*DTimestamp) HasNext() bool
HasNext implements the Datum interface.
func (*DTimestamp) HasPrev ¶
func (*DTimestamp) HasPrev() bool
HasPrev implements the Datum interface.
func (*DTimestamp) ReturnType ¶
func (*DTimestamp) ReturnType() Datum
ReturnType implements the TypedExpr interface.
func (*DTimestamp) String ¶
func (node *DTimestamp) String() string
func (*DTimestamp) TypeCheck ¶
func (d *DTimestamp) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
func (*DTimestamp) TypeEqual ¶
func (d *DTimestamp) TypeEqual(other Datum) bool
TypeEqual implements the Datum interface.
func (*DTimestamp) Walk ¶
func (expr *DTimestamp) Walk(_ Visitor) Expr
Walk implements the Expr interface.
type DTimestampTZ ¶
DTimestampTZ is the timestamp Datum that is rendered with session offset.
func MakeDTimestampTZ ¶
func MakeDTimestampTZ(t time.Time, precision time.Duration) *DTimestampTZ
MakeDTimestampTZ creates a DTimestampTZ with specified precision.
func (*DTimestampTZ) Compare ¶
func (d *DTimestampTZ) Compare(other Datum) int
Compare implements the Datum interface.
func (*DTimestampTZ) Eval ¶
func (t *DTimestampTZ) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*DTimestampTZ) Format ¶
func (d *DTimestampTZ) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*DTimestampTZ) HasNext ¶
func (d *DTimestampTZ) HasNext() bool
HasNext implements the Datum interface.
func (*DTimestampTZ) HasPrev ¶
func (d *DTimestampTZ) HasPrev() bool
HasPrev implements the Datum interface.
func (*DTimestampTZ) IsMax ¶
func (d *DTimestampTZ) IsMax() bool
IsMax implements the Datum interface.
func (*DTimestampTZ) IsMin ¶
func (d *DTimestampTZ) IsMin() bool
IsMin implements the Datum interface.
func (*DTimestampTZ) Next ¶
func (d *DTimestampTZ) Next() Datum
Next implements the Datum interface.
func (*DTimestampTZ) Prev ¶
func (d *DTimestampTZ) Prev() Datum
Prev implements the Datum interface.
func (*DTimestampTZ) ReturnType ¶
func (*DTimestampTZ) ReturnType() Datum
ReturnType implements the TypedExpr interface.
func (*DTimestampTZ) String ¶
func (node *DTimestampTZ) String() string
func (*DTimestampTZ) Type ¶
func (d *DTimestampTZ) Type() string
Type implements the Datum interface.
func (*DTimestampTZ) TypeCheck ¶
func (d *DTimestampTZ) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
func (*DTimestampTZ) TypeEqual ¶
func (d *DTimestampTZ) TypeEqual(other Datum) bool
TypeEqual implements the Datum interface.
func (*DTimestampTZ) Walk ¶
func (expr *DTimestampTZ) Walk(_ Visitor) Expr
Walk implements the Expr interface.
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.
func (*DTuple) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DTuple) SortedDifference ¶
SortedDifference finds the elements of d which are not in other, assuming that d and other are already sorted.
func (*DTuple) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
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.
func (*DValArg) ReturnType ¶
ReturnType implements the TypedExpr interface.
func (*DValArg) TypeCheck ¶
TypeCheck implements the Expr interface. It is implemented as an idempotent identity function for Datum.
type DateColType ¶
type DateColType struct { }
DateColType represents a DATE type.
func (*DateColType) Format ¶
func (node *DateColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*DateColType) String ¶
func (node *DateColType) String() string
type Datum ¶
type Datum interface { TypedExpr // Type returns the (user-friendly) name of the type. Type() string // TypeEqual determines if the receiver and the other Datum have the same // type or not. This method should be used for asserting the type of all // Datum, with the exception of DNull, where it is safe/encouraged to perform // a direct equivalence check. TypeEqual(other Datum) bool // 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. // TODO(nvanbenschoten) Should we look into merging this with cmpOps? 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 ( // TypeBool is the type of a DBool. TypeBool Datum = DBoolFalse // TypeInt is the type of a DInt. TypeInt Datum = NewDInt(0) // TypeFloat is the type of a DFloat. TypeFloat Datum = NewDFloat(0) // TypeDecimal is the type of a DDecimal. TypeDecimal Datum = &DDecimal{} // TypeString is the type of a DString. TypeString Datum = NewDString("") // TypeBytes is the type of a DBytes. TypeBytes Datum = NewDBytes("") // TypeDate is the type of a DDate. TypeDate Datum = NewDDate(0) // TypeTimestamp is the type of a DTimestamp. TypeTimestamp Datum = &DTimestamp{} // TypeTimestampTZ is the type of a DTimestamp. TypeTimestampTZ Datum = &DTimestampTZ{} // TypeInterval is the type of a DInterval. TypeInterval Datum = &DInterval{} // TypeTuple is the type of a DTuple. TypeTuple Datum = &DTuple{} )
type DecimalColType ¶
DecimalColType represents a DECIMAL or NUMERIC type.
func (*DecimalColType) Format ¶
func (node *DecimalColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*DecimalColType) String ¶
func (node *DecimalColType) String() string
type DefaultVal ¶
type DefaultVal struct{}
DefaultVal represents the DEFAULT expression.
func (DefaultVal) Eval ¶
func (expr DefaultVal) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (DefaultVal) Format ¶
func (node DefaultVal) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (DefaultVal) ReturnType ¶
func (DefaultVal) ReturnType() Datum
ReturnType implements the TypedExpr interface.
func (DefaultVal) String ¶
func (node DefaultVal) String() string
func (DefaultVal) TypeCheck ¶
func (expr DefaultVal) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface.
func (DefaultVal) Walk ¶
func (expr DefaultVal) Walk(_ Visitor) Expr
Walk implements the Expr interface.
type Delete ¶
type Delete struct { Table TableExpr Where *Where Returning ReturningExprs }
Delete represents a DELETE statement.
func (*Delete) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Delete) StatementType ¶
func (n *Delete) StatementType() StatementType
StatementType implements the Statement interface.
type DropBehavior ¶
type DropBehavior int
DropBehavior represents options for dropping schema elements.
const ( DropDefault DropBehavior = iota DropRestrict DropCascade )
DropBehavior values.
func (DropBehavior) String ¶
func (d DropBehavior) String() string
type DropDatabase ¶
DropDatabase represents a DROP DATABASE statement.
func (*DropDatabase) Format ¶
func (node *DropDatabase) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*DropDatabase) StatementTag ¶
func (*DropDatabase) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*DropDatabase) StatementType ¶
func (*DropDatabase) StatementType() StatementType
StatementType implements the Statement interface.
func (*DropDatabase) String ¶
func (n *DropDatabase) String() string
type DropIndex ¶
type DropIndex struct { IndexList TableNameWithIndexList IfExists bool DropBehavior DropBehavior }
DropIndex represents a DROP INDEX statement.
func (*DropIndex) StatementTag ¶
StatementTag returns a short string identifying the type of 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) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*DropTable) StatementType ¶
func (*DropTable) StatementType() StatementType
StatementType implements the Statement interface.
type EvalContext ¶
type EvalContext struct { NodeID roachpb.NodeID ReCache *RegexpCache Location *time.Location Args MapArgs // TODO(mjibson): remove prepareOnly in favor of a 2-step prepare-exec solution // that is also able to save the plan to skip work during the exec step. PrepareOnly bool // contains filtered or unexported fields }
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) GetClusterTimestamp ¶
func (ctx *EvalContext) GetClusterTimestamp() *DDecimal
GetClusterTimestamp retrieves the current cluster timestamp as per the evaluation context. The timestamp is guaranteed to be nonzero.
func (EvalContext) GetLocation ¶
func (ctx EvalContext) GetLocation() *time.Location
GetLocation returns the session timezone.
func (*EvalContext) GetStmtTimestamp ¶
func (ctx *EvalContext) GetStmtTimestamp() *DTimestamp
GetStmtTimestamp retrieves the current statement timestamp as per the evaluation context. The timestamp is guaranteed to be nonzero.
func (*EvalContext) GetTxnTimestamp ¶
func (ctx *EvalContext) GetTxnTimestamp(precision time.Duration) *DTimestamp
GetTxnTimestamp retrieves the current transaction timestamp as per the evaluation context. The timestamp is guaranteed to be nonzero.
func (EvalContext) NormalizeExpr ¶
func (ctx EvalContext) NormalizeExpr(typedExpr TypedExpr) (TypedExpr, error)
NormalizeExpr normalizes a typed expression, simplifying where possible, but guaranteeing that the result of evaluating the expression is unchanged and that resulting expression tree is still well-typed. Example normalizations:
(a) -> a 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, precision time.Duration) (*DTimestamp, error)
ParseTimestamp parses the timestamp.
func (*EvalContext) SetClusterTimestamp ¶
func (ctx *EvalContext) SetClusterTimestamp(ts roachpb.Timestamp)
SetClusterTimestamp sets the corresponding timestamp in the EvalContext.
func (*EvalContext) SetStmtTimestamp ¶
func (ctx *EvalContext) SetStmtTimestamp(ts time.Time)
SetStmtTimestamp sets the corresponding timestamp in the EvalContext.
func (*EvalContext) SetTxnTimestamp ¶
func (ctx *EvalContext) SetTxnTimestamp(ts time.Time)
SetTxnTimestamp sets the corresponding timestamp in the EvalContext.
type ExistsExpr ¶
type ExistsExpr struct { Subquery Expr // contains filtered or unexported fields }
ExistsExpr represents an EXISTS expression.
func (*ExistsExpr) Eval ¶
func (t *ExistsExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*ExistsExpr) Format ¶
func (node *ExistsExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (ExistsExpr) ReturnType ¶
func (ta ExistsExpr) ReturnType() Datum
func (*ExistsExpr) String ¶
func (node *ExistsExpr) String() string
func (*ExistsExpr) TypeCheck ¶
func (expr *ExistsExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface.
func (*ExistsExpr) Walk ¶
func (expr *ExistsExpr) Walk(v Visitor) Expr
Walk implements the Expr interface.
type Explain ¶
Explain represents an EXPLAIN statement.
func (*Explain) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Explain) StatementType ¶
func (*Explain) StatementType() StatementType
StatementType implements the Statement interface.
type Expr ¶
type Expr interface { fmt.Stringer NodeFormatter // Walk recursively walks all children using WalkExpr. If any children are changed, it returns a // copy of this node updated to point to the new children. Otherwise the receiver is returned. // For childless (leaf) Exprs, its implementation is empty. Walk(Visitor) Expr // TypeCheck transforms the Expr into a well-typed TypedExpr, which further permits // evaluation and type introspection, or an error if the expression cannot be well-typed. // When type checking is complete, if no error was reported, the expression and all // sub-expressions will be guaranteed to be well-typed, meaning that the method effectively // maps the Expr tree into a TypedExpr tree. // // The args parameter maps ValArg names to types inferred while type-checking. // The desired parameter hints the desired type that the method's caller wants from // the resulting TypedExpr. TypeCheck(args MapArgs, desired Datum) (TypedExpr, error) }
Expr represents an expression.
func ParseExprTraditional ¶
ParseExprTraditional is a short-hand for parseExpr(sql, Traditional)
func SimpleVisit ¶
func SimpleVisit(expr Expr, preFn SimpleVisitFn) (Expr, error)
SimpleVisit is a convenience wrapper for visitors that only have VisitPre code and don't return any results except an error. The given function is called in VisitPre for every node. The visitor stops as soon as an error is returned.
type Exprs ¶
type Exprs []Expr
Exprs represents a list of value expressions. It's not a valid expression because it's not parenthesized.
type FloatColType ¶
FloatColType represents a REAL, DOUBLE or FLOAT type.
func (*FloatColType) Format ¶
func (node *FloatColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*FloatColType) String ¶
func (node *FloatColType) String() string
type FmtFlags ¶
type FmtFlags *fmtFlags
FmtFlags enables conditional formatting in the pretty-printer.
FmtShowTypes instructs the pretty-printer to annotate expressions with their resolved types.
type FuncExpr ¶
type FuncExpr struct { Name *QualifiedName Type funcType Exprs Exprs // contains filtered or unexported fields }
FuncExpr represents a function call.
func (*FuncExpr) CopyNode ¶
CopyNode makes a copy of this Expr without recursing in any child Exprs.
func (*FuncExpr) Eval ¶
func (expr *FuncExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (FuncExpr) ReturnType ¶
func (ta FuncExpr) ReturnType() Datum
type Grant ¶
type Grant struct { Privileges privilege.List Targets TargetList Grantees NameList }
Grant represents a GRANT statement.
func (*Grant) StatementTag ¶
StatementTag returns a short string identifying the type of 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.
func (IfExpr) ReturnType ¶
func (ta IfExpr) ReturnType() Datum
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`.
type IndexHints ¶
IndexHints represents "@<index_name>" or "@{param[,param]}" where param is one of:
- FORCE_INDEX=<index_name>
- NO_INDEX_JOIN
It is used optionally after a table name in SELECT statements.
type IndexTableDef ¶
type IndexTableDef struct { Name Name Columns IndexElemList Storing NameList }
IndexTableDef represents an index definition within a CREATE TABLE statement.
type IndexedVar ¶
type IndexedVar struct { Idx int // contains filtered or unexported fields }
IndexedVar is a VariableExpr that can be used as a leaf in expressions; it represents a dynamic value. It defers calls to TypeCheck, Eval, String to an IndexedVarContainer.
func (*IndexedVar) Eval ¶
func (v *IndexedVar) Eval(ctx EvalContext) (Datum, error)
Eval is part of the TypedExpr interface.
func (*IndexedVar) Format ¶
func (v *IndexedVar) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*IndexedVar) ReturnType ¶
func (v *IndexedVar) ReturnType() Datum
ReturnType is part of the TypedExpr interface.
func (*IndexedVar) String ¶
func (node *IndexedVar) String() string
func (*IndexedVar) TypeCheck ¶
func (v *IndexedVar) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck is part of the Expr interface.
func (*IndexedVar) Variable ¶
func (*IndexedVar) Variable()
Variable is a dummy function part of the VariableExpr interface.
func (*IndexedVar) Walk ¶
func (v *IndexedVar) Walk(_ Visitor) Expr
Walk is part of the Expr interface.
type IndexedVarContainer ¶
type IndexedVarContainer interface { IndexedVarEval(idx int, ctx EvalContext) (Datum, error) IndexedVarReturnType(idx int) Datum IndexedVarString(idx int) string }
IndexedVarContainer provides the implementation of TypeCheck, Eval, and String for IndexedVars.
type IndexedVarHelper ¶
type IndexedVarHelper struct {
// contains filtered or unexported fields
}
IndexedVarHelper is a structure that helps with initialization of IndexVars.
func MakeIndexedVarHelper ¶
func MakeIndexedVarHelper(container IndexedVarContainer, numVars int) IndexedVarHelper
MakeIndexedVarHelper initializes an IndexedVarHelper structure.
func (*IndexedVarHelper) IndexedVar ¶
func (h *IndexedVarHelper) IndexedVar(idx int) *IndexedVar
IndexedVar returns an IndexedVar for the given index. The index must be valid.
func (*IndexedVarHelper) IndexedVarUsed ¶
func (h *IndexedVarHelper) IndexedVarUsed(idx int) bool
IndexedVarUsed returns true if IndexedVar() was called for the given index. The index must be valid.
func (*IndexedVarHelper) NumVars ¶
func (h *IndexedVarHelper) NumVars() int
NumVars returns the number of variables the IndexedVarHelper was initialized for.
type Indirection ¶
type Indirection []IndirectionElem
Indirection represents an indirection expression composed of a series of indirection elements.
type IndirectionElem ¶
type IndirectionElem interface { NodeFormatter // contains filtered or unexported methods }
IndirectionElem is a single element in an indirection expression.
type Insert ¶
type Insert struct { Table TableExpr Columns QualifiedNames Rows *Select OnConflict *OnConflict Returning ReturningExprs }
Insert represents an INSERT statement.
func (*Insert) DefaultValues ¶
DefaultValues returns true iff only default values are being inserted.
func (*Insert) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Insert) StatementType ¶
func (n *Insert) StatementType() StatementType
StatementType implements the Statement interface.
type IntColType ¶
IntColType represents an INT, INTEGER, SMALLINT or BIGINT type.
func (*IntColType) Format ¶
func (node *IntColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*IntColType) String ¶
func (node *IntColType) String() string
type IntervalColType ¶
type IntervalColType struct { }
IntervalColType represents an INTERVAL type
func (*IntervalColType) Format ¶
func (node *IntervalColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*IntervalColType) String ¶
func (node *IntervalColType) String() string
type IsOfTypeExpr ¶
type IsOfTypeExpr struct { Not bool Expr Expr Types []ColumnType // contains filtered or unexported fields }
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) Format ¶
func (node *IsOfTypeExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (IsOfTypeExpr) ReturnType ¶
func (ta IsOfTypeExpr) ReturnType() Datum
func (*IsOfTypeExpr) String ¶
func (node *IsOfTypeExpr) String() string
func (*IsOfTypeExpr) TypeCheck ¶
func (expr *IsOfTypeExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface.
func (*IsOfTypeExpr) Walk ¶
func (expr *IsOfTypeExpr) Walk(v Visitor) Expr
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 { NodeFormatter // contains filtered or unexported methods }
JoinCond represents a join condition.
type JoinTableExpr ¶
JoinTableExpr represents a TableExpr that's a JOIN operation.
func (*JoinTableExpr) Format ¶
func (node *JoinTableExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
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) IsUnresolvedArgument ¶
IsUnresolvedArgument returns whether expr is an unresolved var argument. In other words, it returns whether the provided expression is an argument, and if so, whether the variable's type remains unset or not.
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 Name ¶
type Name string
A Name is an SQL identifier.
type NameIndirection ¶
type NameIndirection Name
NameIndirection represents ".<name>" in an indirection expression.
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 NodeFormatter ¶
type NodeFormatter interface { // Format performs pretty-printing towards a bytes buffer. The // flags argument influences the results. Format(buf *bytes.Buffer, flags FmtFlags) }
NodeFormatter is implemented by nodes that can be pretty-printed.
type NotExpr ¶
type NotExpr struct { Expr Expr // contains filtered or unexported fields }
NotExpr represents a NOT expression.
func NewTypedNotExpr ¶
NewTypedNotExpr returns a new NotExpr that is verified to be well-typed.
func (*NotExpr) Eval ¶
func (expr *NotExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (NotExpr) ReturnType ¶
func (ta NotExpr) ReturnType() Datum
func (*NotExpr) TypedInnerExpr ¶
TypedInnerExpr returns the NotExpr's inner expression as a TypedExpr.
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) Format ¶
func (node *NullIfExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (NullIfExpr) ReturnType ¶
func (ta NullIfExpr) ReturnType() Datum
func (*NullIfExpr) String ¶
func (node *NullIfExpr) String() string
func (*NullIfExpr) TypeCheck ¶
func (expr *NullIfExpr) TypeCheck(args MapArgs, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface.
func (*NullIfExpr) Walk ¶
func (expr *NullIfExpr) Walk(v Visitor) Expr
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 struct { constant.Value // We preserve the "original" string representation (before folding). OrigString string // contains filtered or unexported fields }
NumVal represents a constant numeric value.
func (*NumVal) AvailableTypes ¶
AvailableTypes implements the Constant interface.
TODO(nvanbenschoten) is there a limit past which we should only allow (or prefer) Decimal and not Float? See issue #6369.
func (*NumVal) ResolveAsType ¶
ResolveAsType implements the Constant interface.
type OnConflict ¶
type OnConflict struct { Columns NameList Exprs UpdateExprs Where *Where DoNothing bool }
OnConflict represents an `ON CONFLICT (columns) DO UPDATE SET exprs WHERE where` clause.
The zero value for OnConflict is used to signal the UPSERT short form, which uses the primary key for as the conflict index and the values being inserted for Exprs.
func (*OnConflict) IsUpsertAlias ¶
func (oc *OnConflict) IsUpsertAlias() bool
IsUpsertAlias returns true if the UPSERT syntactic sugar was used.
type OrExpr ¶
type OrExpr struct {
Left, Right Expr
// contains filtered or unexported fields
}
OrExpr represents an OR expression.
func NewTypedOrExpr ¶
NewTypedOrExpr returns a new OrExpr that is verified to be well-typed.
func (*OrExpr) Eval ¶
func (expr *OrExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (OrExpr) ReturnType ¶
func (ta OrExpr) ReturnType() Datum
func (*OrExpr) TypedRight ¶
TypedRight returns the OrExpr's right expression as a TypedExpr.
type OverlayExpr ¶
type OverlayExpr struct {
FuncExpr
}
OverlayExpr represents an overlay function call.
func (*OverlayExpr) Eval ¶
func (expr *OverlayExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*OverlayExpr) Format ¶
func (node *OverlayExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (OverlayExpr) ReturnType ¶
func (ta OverlayExpr) ReturnType() Datum
func (*OverlayExpr) String ¶
func (node *OverlayExpr) String() string
type ParenExpr ¶
type ParenExpr struct { Expr Expr // contains filtered or unexported fields }
ParenExpr represents a parenthesized expression.
func (*ParenExpr) Eval ¶
func (expr *ParenExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (ParenExpr) ReturnType ¶
func (ta ParenExpr) ReturnType() Datum
func (*ParenExpr) TypedInnerExpr ¶
TypedInnerExpr returns the ParenExpr's inner expression as a TypedExpr.
type ParenSelect ¶
type ParenSelect struct {
Select *Select
}
ParenSelect represents a parenthesized SELECT/UNION/VALUES statement.
func (*ParenSelect) Format ¶
func (node *ParenSelect) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*ParenSelect) StatementTag ¶
func (*ParenSelect) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*ParenSelect) StatementType ¶
func (*ParenSelect) StatementType() StatementType
StatementType implements the Statement interface.
func (*ParenSelect) String ¶
func (n *ParenSelect) String() string
func (*ParenSelect) WalkStmt ¶
func (stmt *ParenSelect) WalkStmt(v Visitor) Statement
WalkStmt is part of the WalkableStmt interface.
type ParenTableExpr ¶
type ParenTableExpr struct {
Expr TableExpr
}
ParenTableExpr represents a parenthesized TableExpr.
func (*ParenTableExpr) Format ¶
func (node *ParenTableExpr) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
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) NormalizeExpr ¶
func (p *Parser) NormalizeExpr(ctx EvalContext, typedExpr TypedExpr) (TypedExpr, error)
NormalizeExpr is wrapper around ctx.NormalizeExpr which avoids allocation of a normalizeVisitor.
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) ClearString ¶
func (node *QualifiedName) ClearString()
ClearString causes String to return the current (possibly normalized) name instead of the original name (used for testing).
func (*QualifiedName) Column ¶
func (node *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 (node *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 (expr *QualifiedName) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*QualifiedName) Format ¶
func (node *QualifiedName) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*QualifiedName) IsStar ¶
func (node *QualifiedName) IsStar() bool
IsStar returns true iff the qualified name contains matches "".* or table.*.
func (*QualifiedName) NormalizeColumnName ¶
func (node *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 (node *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) QualifyWithDatabase ¶
func (node *QualifiedName) QualifyWithDatabase(database string) error
QualifyWithDatabase adds an indirection for the database, if it's missing. It transforms: table -> database.table table@index -> database.table@index * -> database.*
func (*QualifiedName) ReturnType ¶
func (node *QualifiedName) ReturnType() Datum
ReturnType implements the TypedExpr interface.
func (*QualifiedName) String ¶
func (node *QualifiedName) String() string
func (*QualifiedName) Table ¶
func (node *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, desired Datum) (TypedExpr, error)
TypeCheck implements the Expr interface.
func (*QualifiedName) Variable ¶
func (*QualifiedName) Variable()
Variable implements the VariableExpr interface.
func (*QualifiedName) Walk ¶
func (expr *QualifiedName) Walk(_ Visitor) Expr
Walk implements the Expr interface.
type QualifiedNames ¶
type QualifiedNames []*QualifiedName
QualifiedNames represents a command separated list (see the String method) of qualified names.
type RangeCond ¶
type RangeCond struct { Not bool Left Expr From, To Expr // contains filtered or unexported fields }
RangeCond represents a BETWEEN or a NOT BETWEEN expression.
func (*RangeCond) Eval ¶
func (expr *RangeCond) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (RangeCond) ReturnType ¶
func (ta RangeCond) ReturnType() Datum
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) 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 ReleaseSavepoint ¶
type ReleaseSavepoint struct {
Savepoint string
}
ReleaseSavepoint represents a RELEASE SAVEPOINT <name> statement.
func (*ReleaseSavepoint) Format ¶
func (node *ReleaseSavepoint) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*ReleaseSavepoint) StatementTag ¶
func (*ReleaseSavepoint) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*ReleaseSavepoint) StatementType ¶
func (*ReleaseSavepoint) StatementType() StatementType
StatementType implements the Statement interface.
func (*ReleaseSavepoint) String ¶
func (n *ReleaseSavepoint) String() string
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) Format ¶
func (node *RenameColumn) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*RenameColumn) StatementTag ¶
func (*RenameColumn) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*RenameColumn) StatementType ¶
func (*RenameColumn) StatementType() StatementType
StatementType implements the Statement interface.
func (*RenameColumn) String ¶
func (n *RenameColumn) String() string
type RenameDatabase ¶
RenameDatabase represents a RENAME DATABASE statement.
func (*RenameDatabase) Format ¶
func (node *RenameDatabase) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*RenameDatabase) StatementTag ¶
func (*RenameDatabase) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*RenameDatabase) StatementType ¶
func (*RenameDatabase) StatementType() StatementType
StatementType implements the Statement interface.
func (*RenameDatabase) String ¶
func (n *RenameDatabase) String() string
type RenameIndex ¶
type RenameIndex struct { Index *TableNameWithIndex NewName Name IfExists bool }
RenameIndex represents a RENAME INDEX statement.
func (*RenameIndex) Format ¶
func (node *RenameIndex) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*RenameIndex) StatementTag ¶
func (*RenameIndex) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*RenameIndex) StatementType ¶
func (*RenameIndex) StatementType() StatementType
StatementType implements the Statement interface.
func (*RenameIndex) String ¶
func (n *RenameIndex) String() string
type RenameTable ¶
type RenameTable struct { Name *QualifiedName NewName *QualifiedName IfExists bool }
RenameTable represents a RENAME TABLE statement.
func (*RenameTable) Format ¶
func (node *RenameTable) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*RenameTable) StatementTag ¶
func (*RenameTable) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*RenameTable) StatementType ¶
func (*RenameTable) StatementType() StatementType
StatementType implements the Statement interface.
func (*RenameTable) String ¶
func (n *RenameTable) String() string
type ReturningExprs ¶
type ReturningExprs SelectExprs
ReturningExprs represents RETURNING expressions.
func (ReturningExprs) Format ¶
func (r ReturningExprs) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (ReturningExprs) StatementType ¶
func (r ReturningExprs) StatementType() StatementType
StatementType implements the Statement interface.
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) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Revoke) StatementType ¶
func (*Revoke) StatementType() StatementType
StatementType implements the Statement interface.
type RollbackToSavepoint ¶
type RollbackToSavepoint struct {
Savepoint string
}
RollbackToSavepoint represents a ROLLBACK TO SAVEPOINT <name> statement.
func (*RollbackToSavepoint) Format ¶
func (node *RollbackToSavepoint) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*RollbackToSavepoint) StatementTag ¶
func (*RollbackToSavepoint) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*RollbackToSavepoint) StatementType ¶
func (*RollbackToSavepoint) StatementType() StatementType
StatementType implements the Statement interface.
func (*RollbackToSavepoint) String ¶
func (n *RollbackToSavepoint) String() string
type RollbackTransaction ¶
type RollbackTransaction struct{}
RollbackTransaction represents a ROLLBACK statement.
func (*RollbackTransaction) Format ¶
func (node *RollbackTransaction) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*RollbackTransaction) StatementTag ¶
func (*RollbackTransaction) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*RollbackTransaction) StatementType ¶
func (*RollbackTransaction) StatementType() StatementType
StatementType implements the Statement interface.
func (*RollbackTransaction) String ¶
func (n *RollbackTransaction) String() string
type Savepoint ¶
type Savepoint struct {
Name string
}
Savepoint represents a SAVEPOINT <name> statement.
func (*Savepoint) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Savepoint) StatementType ¶
func (*Savepoint) StatementType() StatementType
StatementType implements the Statement interface.
type Select ¶
type Select struct { Select SelectStatement OrderBy OrderBy Limit *Limit }
Select represents a SelectStatement with an ORDER and/or LIMIT.
func (*Select) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Select) StatementType ¶
func (*Select) StatementType() StatementType
StatementType implements the Statement interface.
type SelectClause ¶
type SelectClause struct { Distinct bool Exprs SelectExprs From TableExprs Where *Where GroupBy GroupBy Having *Where Lock string // contains filtered or unexported fields }
SelectClause represents a SELECT statement.
func (*SelectClause) CopyNode ¶
func (stmt *SelectClause) CopyNode() *SelectClause
CopyNode makes a copy of this Expr without recursing in any child Exprs.
func (*SelectClause) Format ¶
func (node *SelectClause) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*SelectClause) StatementTag ¶
func (*SelectClause) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*SelectClause) StatementType ¶
func (*SelectClause) StatementType() StatementType
StatementType implements the Statement interface.
func (*SelectClause) String ¶
func (n *SelectClause) String() string
func (*SelectClause) WalkStmt ¶
func (stmt *SelectClause) WalkStmt(v Visitor) Statement
WalkStmt is part of the WalkableStmt interface.
type SelectExpr ¶
SelectExpr represents a SELECT expression.
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) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Set) StatementType ¶
func (*Set) StatementType() StatementType
StatementType implements the Statement interface.
type SetDefaultIsolation ¶
type SetDefaultIsolation struct {
Isolation IsolationLevel
}
SetDefaultIsolation represents a SET SESSION CHARACTERISTICS AS TRANSACTION statement.
func (*SetDefaultIsolation) Format ¶
func (node *SetDefaultIsolation) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*SetDefaultIsolation) StatementTag ¶
func (*SetDefaultIsolation) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*SetDefaultIsolation) StatementType ¶
func (*SetDefaultIsolation) StatementType() StatementType
StatementType implements the Statement interface.
func (*SetDefaultIsolation) String ¶
func (n *SetDefaultIsolation) String() string
type SetTimeZone ¶
type SetTimeZone struct {
Value Expr
}
SetTimeZone represents a SET TIME ZONE statement.
func (*SetTimeZone) Format ¶
func (node *SetTimeZone) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*SetTimeZone) StatementTag ¶
func (*SetTimeZone) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*SetTimeZone) StatementType ¶
func (*SetTimeZone) StatementType() StatementType
StatementType implements the Statement interface.
func (*SetTimeZone) String ¶
func (n *SetTimeZone) String() string
type SetTransaction ¶
type SetTransaction struct { Isolation IsolationLevel UserPriority UserPriority }
SetTransaction represents a SET TRANSACTION statement.
func (*SetTransaction) Format ¶
func (node *SetTransaction) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*SetTransaction) StatementTag ¶
func (*SetTransaction) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*SetTransaction) StatementType ¶
func (*SetTransaction) StatementType() StatementType
StatementType implements the Statement interface.
func (*SetTransaction) String ¶
func (n *SetTransaction) String() string
type Show ¶
type Show struct {
Name string
}
Show represents a SHOW statement.
func (*Show) StatementTag ¶
StatementTag returns a short string identifying the type of 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) Format ¶
func (node *ShowColumns) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*ShowColumns) StatementTag ¶
func (*ShowColumns) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*ShowColumns) StatementType ¶
func (*ShowColumns) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowColumns) String ¶
func (n *ShowColumns) String() string
type ShowCreateTable ¶
type ShowCreateTable struct {
Table *QualifiedName
}
ShowCreateTable represents a SHOW CREATE TABLE statement.
func (*ShowCreateTable) Format ¶
func (node *ShowCreateTable) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*ShowCreateTable) StatementTag ¶
func (*ShowCreateTable) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*ShowCreateTable) StatementType ¶
func (*ShowCreateTable) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowCreateTable) String ¶
func (n *ShowCreateTable) String() string
type ShowDatabases ¶
type ShowDatabases struct { }
ShowDatabases represents a SHOW DATABASES statement.
func (*ShowDatabases) Format ¶
func (node *ShowDatabases) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*ShowDatabases) StatementTag ¶
func (*ShowDatabases) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*ShowDatabases) StatementType ¶
func (*ShowDatabases) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowDatabases) String ¶
func (n *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) Format ¶
func (node *ShowGrants) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*ShowGrants) StatementTag ¶
func (*ShowGrants) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*ShowGrants) StatementType ¶
func (*ShowGrants) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowGrants) String ¶
func (n *ShowGrants) String() string
type ShowIndex ¶
type ShowIndex struct {
Table *QualifiedName
}
ShowIndex represents a SHOW INDEX statement.
func (*ShowIndex) StatementTag ¶
StatementTag returns a short string identifying the type of 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) Format ¶
func (node *ShowTables) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*ShowTables) StatementTag ¶
func (*ShowTables) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*ShowTables) StatementType ¶
func (*ShowTables) StatementType() StatementType
StatementType implements the Statement interface.
func (*ShowTables) String ¶
func (n *ShowTables) String() string
type SimpleTableExpr ¶
type SimpleTableExpr interface { NodeFormatter // contains filtered or unexported methods }
SimpleTableExpr represents a simple table expression.
type SimpleVisitFn ¶
SimpleVisitFn is a function that is run for every node in the VisitPre stage; see SimpleVisit.
type SingleType ¶
type SingleType struct {
Typ Datum
}
SingleType is a typeList implementation which accepts a single argument of type typ. It is logically identical to an ArgTypes implementation with length 1, but avoids the slice allocation.
type StarIndirection ¶
type StarIndirection string
StarIndirection represents ".*" in an indirection expression.
type Statement ¶
type Statement interface { fmt.Stringer NodeFormatter StatementType() StatementType // StatementTag is a short string identifying the type of statement // (usually a single verb). This is different than the Stringer output, // which is the actual statement (including args). // TODO(dt): Currently tags are always pg-compatible in the future it // might make sense to pass a tag format specifier. StatementTag() string }
Statement represents a statement.
func FillArgs ¶
FillArgs replaces any placeholder nodes in the expression with arguments supplied with the query.
func ParseOneTraditional ¶
ParseOneTraditional is short-hand for ParseOne(sql, Traditional)
type StatementList ¶
type StatementList []Statement
StatementList is a list of statements.
func (StatementList) Format ¶
func (l StatementList) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
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 StrVal ¶
type StrVal struct {
// contains filtered or unexported fields
}
StrVal represents a constant string value.
func (*StrVal) AvailableTypes ¶
AvailableTypes implements the Constant interface.
func (*StrVal) ResolveAsType ¶
ResolveAsType implements the Constant interface.
type StringColType ¶
StringColType represents a STRING, CHAR or VARCHAR type.
func (*StringColType) Format ¶
func (node *StringColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*StringColType) String ¶
func (node *StringColType) String() string
type Subquery ¶
type Subquery struct {
Select SelectStatement
}
Subquery represents a subquery.
func (*Subquery) Eval ¶
func (expr *Subquery) Eval(_ EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*Subquery) ReturnType ¶
ReturnType implements the TypedExpr interface.
type TableDef ¶
type TableDef interface { NodeFormatter // contains filtered or unexported methods }
TableDef represents a column, index or constraint definition within a CREATE TABLE statement.
type TableExpr ¶
type TableExpr interface { NodeFormatter // contains filtered or unexported methods }
TableExpr represents a table expression.
type TableNameWithIndex ¶
type TableNameWithIndex struct { Table *QualifiedName Index Name }
TableNameWithIndex represents a "table@index", used in statements that specifically refer to an index.
type TableNameWithIndexList ¶
type TableNameWithIndexList []*TableNameWithIndex
TableNameWithIndexList is a list of indexes.
type TargetList ¶
type TargetList struct { Databases NameList Tables QualifiedNames }
TargetList represents a list of targets. Only one field may be non-nil.
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 TimestampColType ¶
type TimestampColType struct { }
TimestampColType represents a TIMESTAMP type.
func (*TimestampColType) Format ¶
func (node *TimestampColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*TimestampColType) String ¶
func (node *TimestampColType) String() string
type TimestampTZColType ¶
type TimestampTZColType struct { }
TimestampTZColType represents a TIMESTAMP type.
func (*TimestampTZColType) Format ¶
func (node *TimestampTZColType) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*TimestampTZColType) String ¶
func (node *TimestampTZColType) String() string
type Truncate ¶
type Truncate struct { Tables QualifiedNames DropBehavior DropBehavior }
Truncate represents a TRUNCATE statement.
func (*Truncate) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Truncate) StatementType ¶
func (*Truncate) StatementType() StatementType
StatementType implements the Statement interface.
type Tuple ¶
type Tuple struct { Exprs Exprs // contains filtered or unexported fields }
Tuple represents a parenthesized list of expressions.
func (*Tuple) Eval ¶
func (t *Tuple) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (*Tuple) ReturnType ¶
ReturnType implements the TypedExpr interface.
type TypedExpr ¶
type TypedExpr interface { Expr // 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) // ReturnType provides the type of the TypedExpr, which is the type of Datum that // the TypedExpr will return when evaluated. ReturnType() Datum }
TypedExpr represents a well-typed expression.
func TypeCheck ¶
TypeCheck performs type checking on the provided expression tree, returning the new typed expression tree, which additionally permits evaluation and type introspection globally and on each sub-tree.
While doing so, it will fold numeric constants and bind var argument names to their inferred types in the args parameter. The optional desired parameter can be used to hint the desired type for the root of the resulting typed expression tree.
func TypeCheckAndRequire ¶
TypeCheckAndRequire performs type checking on the provided expression tree in an identical manner to TypeCheck. It then asserts that the resulting TypedExpr has the provided return type, returning both the typed expression and an error if it does not.
func TypeConstants ¶
TypeConstants type checks all Constant literal expressions, resolving them as the Datum representations of their values. Before doing so, it first folds all numeric constants.
This means that Constants will become TypedExprs so that they can be used in contexts which expect a TypedExpr tree (such as Normalization). As such, the function is primarily intended for use while testing expressions where full type checking is not desired.
TODO(nvanbenschoten) Can this visitor be preallocated (like normalizeVisitor)?
type TypedExprs ¶
type TypedExprs []TypedExpr
TypedExprs represents a list of well-typed value expressions. It's not a valid expression because it's not parenthesized.
func (TypedExprs) String ¶
func (node TypedExprs) String() string
type UnaryExpr ¶
type UnaryExpr struct { Operator UnaryOperator Expr Expr // contains filtered or unexported fields }
UnaryExpr represents a unary value expression.
func (*UnaryExpr) Eval ¶
func (expr *UnaryExpr) Eval(ctx EvalContext) (Datum, error)
Eval implements the Expr interface.
func (UnaryExpr) ReturnType ¶
func (ta UnaryExpr) ReturnType() Datum
type UnaryOperator ¶
type UnaryOperator int
UnaryOperator represents a unary operator.
const ( UnaryPlus UnaryOperator = iota UnaryMinus UnaryComplement )
UnaryExpr.Operator
func (UnaryOperator) String ¶
func (i UnaryOperator) String() string
type UnionClause ¶
UnionClause represents a UNION statement.
func (*UnionClause) Format ¶
func (node *UnionClause) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (*UnionClause) StatementTag ¶
func (*UnionClause) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (*UnionClause) StatementType ¶
func (*UnionClause) StatementType() StatementType
StatementType implements the Statement interface.
func (*UnionClause) String ¶
func (n *UnionClause) String() string
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.
type Update ¶
type Update struct { Table TableExpr Exprs UpdateExprs Where *Where Returning ReturningExprs }
Update represents an UPDATE statement.
func (*Update) StatementTag ¶
StatementTag returns a short string identifying the type of statement.
func (*Update) StatementType ¶
func (n *Update) StatementType() StatementType
StatementType implements the Statement interface.
type UpdateExpr ¶
type UpdateExpr struct { Tuple bool Names QualifiedNames Expr Expr }
UpdateExpr represents an update expression.
type UpdateExprs ¶
type UpdateExprs []*UpdateExpr
UpdateExprs represents a list of update expressions.
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.
type ValArg ¶
type ValArg struct {
Name string
}
ValArg represents a named bind var argument.
type ValuesClause ¶
type ValuesClause struct {
Tuples []*Tuple
}
ValuesClause represents a VALUES clause.
func (*ValuesClause) Format ¶
func (node *ValuesClause) Format(buf *bytes.Buffer, f FmtFlags)
Format implements the NodeFormatter interface.
func (ValuesClause) StatementTag ¶
func (ValuesClause) StatementTag() string
StatementTag returns a short string identifying the type of statement.
func (ValuesClause) StatementType ¶
func (ValuesClause) StatementType() StatementType
StatementType implements the Statement interface.
func (*ValuesClause) String ¶
func (n *ValuesClause) String() string
func (*ValuesClause) WalkStmt ¶
func (stmt *ValuesClause) WalkStmt(v Visitor) Statement
WalkStmt is part of the WalkableStmt 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 VariadicType ¶
type VariadicType struct {
Typ Datum
}
VariadicType is a typeList implementation which accepts any number of arguments and matches when each argument is either NULL or of the type typ.
type Visitor ¶
type Visitor interface { // VisitPre is called for each node before recursing into that subtree. Upon return, if recurse // is false, the visit will not recurse into the subtree (and VisitPost will not be called for // this node). // // The returned Expr replaces the visited expression and can be used for rewriting expressions. // The function should NOT modify nodes in-place; it should make copies of nodes. The Walk // infrastructure will automatically make copies of parents as needed. VisitPre(expr Expr) (recurse bool, newExpr Expr) // VisitPost is called for each node after recursing into the subtree. The returned Expr // replaces the visited expression and can be used for rewriting expressions. // // The returned Expr replaces the visited expression and can be used for rewriting expressions. // The function should NOT modify nodes in-place; it should make and return copies of nodes. The // Walk infrastructure will automatically make copies of parents as needed. VisitPost(expr Expr) (newNode Expr) }
Visitor defines methods that are called for nodes during an expression or statement walk.
type WalkableStmt ¶
WalkableStmt is implemented by statements that can appear inside an expression (selects) or we want to start a walk from (using WalkStmt).
Source Files ¶
- alter_table.go
- builtins.go
- col_types.go
- constant.go
- create.go
- datum.go
- delete.go
- drop.go
- encode.go
- eval.go
- explain.go
- expr.go
- format.go
- grant.go
- indexed_vars.go
- indirection.go
- insert.go
- interval.go
- keywords.go
- name.go
- normalize.go
- overload.go
- parse.go
- regexp_cache.go
- rename.go
- reserved_keywords.go
- returning.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
- union.go
- update.go
- values.go
- walk.go