evalengine

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 48 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEvaluatedExprNotSupported = "expr cannot be evaluated, not supported"
View Source
var ErrHashCoercionIsNotExact = vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "cannot coerce into target type without losing precision")
View Source
var ErrTranslateExprNotSupported = "expr cannot be translated, not supported"
View Source
var NullExpr = &Literal{}

NullExpr is just what you are lead to believe

View Source
var SystemTime = time.Now
View Source
var UnsupportedCollationHashError = vterrors.Errorf(vtrpcpb.Code_INTERNAL, "text type with an unknown/unsupported collation cannot be hashed")

UnsupportedCollationHashError is returned when we try to get the hash value and are missing the collation to use

Functions

func Add

func Add(v1, v2 sqltypes.Value) (sqltypes.Value, error)

Add adds two values together if v1 or v2 is null, then it returns null

func AggregateTypes added in v0.19.0

func AggregateTypes(types []sqltypes.Type) sqltypes.Type

func CoerceTo added in v0.13.0

func CoerceTo(value sqltypes.Value, typ sqltypes.Type, sqlmode SQLMode) (sqltypes.Value, error)

func Divide

func Divide(v1, v2 sqltypes.Value) (sqltypes.Value, error)

Divide (Float) for MySQL. Replicates behavior of "/" operator

func Multiply

func Multiply(v1, v2 sqltypes.Value) (sqltypes.Value, error)

Multiply takes two values and multiplies it together

func NullSafeAdd added in v0.13.0

func NullSafeAdd(v1, v2 sqltypes.Value, resultType sqltypes.Type) (sqltypes.Value, error)

NullSafeAdd adds two Values in a null-safe manner. A null value is treated as 0. If both values are null, then a null is returned. If both values are not null, a numeric value is built from each input: Signed->int64, Unsigned->uint64, Float->float64. Otherwise the 'best type fit' is chosen for the number: int64 or float64. opArithAdd is performed by upgrading types as needed, or in case of overflow: int64->uint64, int64->float64, uint64->float64. Unsigned ints can only be added to positive ints. After the addition, if one of the input types was Decimal, then a Decimal is built. Otherwise, the final type of the result is preserved.

func NullsafeCompare

func NullsafeCompare(v1, v2 sqltypes.Value, collationEnv *collations.Environment, collationID collations.ID) (int, error)

NullsafeCompare returns 0 if v1==v2, -1 if v1<v2, and 1 if v1>v2. NULL is the lowest value. If any value is numeric, then a numeric comparison is performed after necessary conversions. If none are numeric, then it's a simple binary comparison. Uncomparable values return an error.

func NullsafeHashcode128 added in v0.17.0

func NullsafeHashcode128(hash *vthash.Hasher, v sqltypes.Value, collation collations.ID, coerceTo sqltypes.Type, sqlmode SQLMode) error

NullsafeHashcode128 returns a 128-bit hashcode that is guaranteed to be the same for two values that are considered equal by `NullsafeCompare`. This can be used to avoid having to do comparison checks after a hash, since we consider the 128 bits of entropy enough to guarantee uniqueness.

func PanicHandler added in v0.19.0

func PanicHandler(err *error)

func Subtract

func Subtract(v1, v2 sqltypes.Value) (sqltypes.Value, error)

Subtract takes two values and subtracts them

func TinyWeighter added in v0.19.0

func TinyWeighter(f *querypb.Field, collation collations.ID) func(v *sqltypes.Value)

TinyWeighter returns a callback to apply a Tiny Weight string to a sqltypes.Value. A tiny weight string is a compressed 4-byte representation of the value's full weight string that sorts identically to its full weight. Obviously, the tiny weight string can collide because it's represented in fewer bytes than the full one. Hence, for any 2 instances of sqltypes.Value: if both instances have a Tiny Weight string, and the weight strings are **different**, the two values will sort accordingly to the 32-bit numerical sort of their tiny weight strings. Otherwise, the relative sorting of the two values will not be known, and they will require a full sort using e.g. NullsafeCompare.

func WeightString added in v0.18.0

func WeightString(dst []byte, v sqltypes.Value, coerceTo sqltypes.Type, col collations.ID, length, precision int, sqlmode SQLMode) ([]byte, bool, error)

WeightString returns the weight string for a value. It appends to dst if an existing slice is given, otherwise it returns a new one. The returned boolean indicates whether the weight string is a fixed-width weight string, such as for fixed size integer values. Our WeightString implementation supports more types that MySQL externally communicates with the `WEIGHT_STRING` function, so that we can also use this to order / sort other types like Float and Decimal as well.

Types

type Arena added in v0.17.0

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

Arena is an arena memory allocator for eval types. It allocates the types from reusable slices to prevent heap allocations. After each evaluation execution, (*Arena).reset() should be called to reset the arena.

type ArithmeticExpr added in v0.13.0

type ArithmeticExpr struct {
	BinaryExpr
	Op opArith
}

func (*ArithmeticExpr) CachedSize added in v0.13.0

func (cached *ArithmeticExpr) CachedSize(alloc bool) int64

type BinaryExpr

type BinaryExpr struct {
	Left, Right IR
}

func (*BinaryExpr) CachedSize added in v0.13.0

func (cached *BinaryExpr) CachedSize(alloc bool) int64

type BindVariable

type BindVariable struct {
	Key       string
	Type      sqltypes.Type
	Collation collations.ID
	// contains filtered or unexported fields
}

func NewBindVar added in v0.8.0

func NewBindVar(key string, typ Type) *BindVariable

NewBindVar returns a bind variable

func NewBindVarTuple added in v0.17.0

func NewBindVarTuple(key string, coll collations.ID) *BindVariable

NewBindVarTuple returns a bind variable containing a tuple

func (*BindVariable) CachedSize added in v0.10.0

func (cached *BindVariable) CachedSize(alloc bool) int64

func (*BindVariable) Format added in v0.19.0

func (bv *BindVariable) Format(buf *sqlparser.TrackedBuffer)

func (*BindVariable) FormatFast added in v0.19.0

func (bv *BindVariable) FormatFast(buf *sqlparser.TrackedBuffer)

func (*BindVariable) IR added in v0.19.0

func (bv *BindVariable) IR() IR

func (*BindVariable) IsExpr added in v0.19.0

func (bv *BindVariable) IsExpr()

type BitwiseExpr added in v0.14.0

type BitwiseExpr struct {
	BinaryExpr
	Op opBit
}

func (*BitwiseExpr) CachedSize added in v0.14.0

func (cached *BitwiseExpr) CachedSize(alloc bool) int64

type BitwiseNotExpr added in v0.14.0

type BitwiseNotExpr struct {
	UnaryExpr
}

func (*BitwiseNotExpr) CachedSize added in v0.14.0

func (cached *BitwiseNotExpr) CachedSize(alloc bool) int64

type CallExpr added in v0.13.0

type CallExpr struct {
	Arguments TupleExpr
	Method    string
}

func (*CallExpr) CachedSize added in v0.13.0

func (cached *CallExpr) CachedSize(alloc bool) int64

type CaseExpr added in v0.14.0

type CaseExpr struct {
	Else IR
	// contains filtered or unexported fields
}

func (*CaseExpr) CachedSize added in v0.14.0

func (cached *CaseExpr) CachedSize(alloc bool) int64

type CollateExpr added in v0.13.0

type CollateExpr struct {
	UnaryExpr
	TypedCollation collations.TypedCollation
	CollationEnv   *collations.Environment
}

func (*CollateExpr) CachedSize added in v0.13.0

func (cached *CollateExpr) CachedSize(alloc bool) int64

type Column

type Column struct {
	Offset    int
	Type      sqltypes.Type
	Size      int32
	Scale     int32
	Collation collations.TypedCollation
	Original  sqlparser.Expr
	Nullable  bool
	// contains filtered or unexported fields
}

func NewColumn added in v0.8.0

func NewColumn(offset int, typ Type, original sqlparser.Expr) *Column

NewColumn returns a column expression

func (*Column) CachedSize added in v0.10.0

func (cached *Column) CachedSize(alloc bool) int64

func (*Column) Format added in v0.19.0

func (c *Column) Format(buf *sqlparser.TrackedBuffer)

func (*Column) FormatFast added in v0.19.0

func (c *Column) FormatFast(buf *sqlparser.TrackedBuffer)

func (*Column) IR added in v0.19.0

func (c *Column) IR() IR

func (*Column) IsExpr added in v0.19.0

func (c *Column) IsExpr()

type ColumnResolver added in v0.17.0

type ColumnResolver func(name *sqlparser.ColName) (int, error)

type Comparison added in v0.19.0

type Comparison []OrderByParams

OrderByParams specifies the parameters for ordering. This is used for merge-sorting scatter queries.

func (Comparison) ApplyTinyWeights added in v0.19.0

func (cmp Comparison) ApplyTinyWeights(out *sqltypes.Result)

func (Comparison) Compare added in v0.19.0

func (cmp Comparison) Compare(a, b sqltypes.Row) int

func (Comparison) Less added in v0.19.0

func (cmp Comparison) Less(a, b sqltypes.Row) bool

func (Comparison) More added in v0.19.0

func (cmp Comparison) More(a, b sqltypes.Row) bool

func (Comparison) Sort added in v0.19.0

func (cmp Comparison) Sort(out []sqltypes.Row)

func (Comparison) SortResult added in v0.19.0

func (cmp Comparison) SortResult(out *sqltypes.Result) (err error)

type ComparisonExpr added in v0.13.0

type ComparisonExpr struct {
	BinaryExpr
	Op ComparisonOp
}

func (*ComparisonExpr) CachedSize added in v0.13.0

func (cached *ComparisonExpr) CachedSize(alloc bool) int64

type ComparisonOp added in v0.13.0

type ComparisonOp interface {
	String() string
	// contains filtered or unexported methods
}

type CompiledExpr added in v0.17.0

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

func (*CompiledExpr) CachedSize added in v0.17.0

func (cached *CompiledExpr) CachedSize(alloc bool) int64

func (*CompiledExpr) Format added in v0.19.0

func (p *CompiledExpr) Format(buf *sqlparser.TrackedBuffer)

func (*CompiledExpr) FormatFast added in v0.19.0

func (p *CompiledExpr) FormatFast(buf *sqlparser.TrackedBuffer)

func (*CompiledExpr) IR added in v0.19.0

func (c *CompiledExpr) IR() IR

func (*CompiledExpr) IsExpr added in v0.19.0

func (c *CompiledExpr) IsExpr()

type CompilerLog added in v0.17.0

type CompilerLog interface {
	Instruction(ins string, args ...any)
	Stack(old, new int)
}

type Config added in v0.17.0

type Config struct {
	ResolveColumn ColumnResolver
	ResolveType   TypeResolver

	Collation         collations.ID
	NoConstantFolding bool
	NoCompilation     bool
	SQLMode           SQLMode
	Environment       *vtenv.Environment
}

type ConvertExpr added in v0.14.0

type ConvertExpr struct {
	UnaryExpr
	Type          string
	Length, Scale *int
	Collation     collations.ID
	CollationEnv  *collations.Environment
}

func (*ConvertExpr) CachedSize added in v0.14.0

func (cached *ConvertExpr) CachedSize(alloc bool) int64

type ConvertUsingExpr added in v0.14.0

type ConvertUsingExpr struct {
	UnaryExpr
	Collation    collations.ID
	CollationEnv *collations.Environment
}

func (*ConvertUsingExpr) CachedSize added in v0.14.0

func (cached *ConvertUsingExpr) CachedSize(alloc bool) int64

type EvalResult

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

func (EvalResult) Collation added in v0.14.0

func (er EvalResult) Collation() collations.ID

func (EvalResult) MustBoolean added in v0.15.0

func (er EvalResult) MustBoolean() bool

func (EvalResult) String added in v0.14.0

func (er EvalResult) String() string

func (EvalResult) ToBoolean added in v0.15.5

func (er EvalResult) ToBoolean() bool

func (EvalResult) ToBooleanStrict added in v0.8.0

func (er EvalResult) ToBooleanStrict() (bool, error)

ToBooleanStrict is used when the casting to a boolean has to be minimally forgiving, such as when assigning to a system variable that is expected to be a boolean

func (EvalResult) TupleValues added in v0.13.0

func (er EvalResult) TupleValues() []sqltypes.Value

TupleValues allows for retrieval of the value we expose for public consumption

func (EvalResult) Value

func (er EvalResult) Value(id collations.ID) sqltypes.Value

Value allows for retrieval of the value we expose for public consumption. It will be converted to the passed in collation which is the connection collation and what the client expects the result to be in.

type Expr

type Expr interface {
	sqlparser.Expr
	IR() IR
	// contains filtered or unexported methods
}

Expr is a compiled expression that can be evaluated and serialized back to SQL.

func Translate added in v0.14.0

func Translate(e sqlparser.Expr, cfg *Config) (Expr, error)

type ExpressionEnv

type ExpressionEnv struct {
	BindVars map[string]*querypb.BindVariable
	Row      []sqltypes.Value
	Fields   []*querypb.Field
	// contains filtered or unexported fields
}

ExpressionEnv contains the environment that the expression evaluates in, such as the current row and bindvars

func EmptyExpressionEnv added in v0.13.0

func EmptyExpressionEnv(env *vtenv.Environment) *ExpressionEnv

EmptyExpressionEnv returns a new ExpressionEnv with no bind vars or row

func NewExpressionEnv added in v0.17.0

func NewExpressionEnv(ctx context.Context, bindVars map[string]*querypb.BindVariable, vc VCursor) *ExpressionEnv

NewExpressionEnv returns an expression environment with no current row, but with bindvars

func (*ExpressionEnv) Evaluate added in v0.13.0

func (env *ExpressionEnv) Evaluate(expr Expr) (EvalResult, error)

func (*ExpressionEnv) EvaluateAST added in v0.19.0

func (env *ExpressionEnv) EvaluateAST(expr Expr) (EvalResult, error)

func (*ExpressionEnv) EvaluateVM added in v0.17.0

func (env *ExpressionEnv) EvaluateVM(p *CompiledExpr) (EvalResult, error)

func (*ExpressionEnv) SetTime added in v0.19.0

func (env *ExpressionEnv) SetTime(now time.Time)

func (*ExpressionEnv) TypeOf added in v0.13.0

func (env *ExpressionEnv) TypeOf(expr Expr) (Type, error)

func (*ExpressionEnv) VCursor added in v0.19.0

func (env *ExpressionEnv) VCursor() VCursor

type FieldResolver added in v0.17.0

type FieldResolver []*querypb.Field

func (FieldResolver) Column added in v0.17.0

func (fields FieldResolver) Column(col *sqlparser.ColName) (int, error)

func (FieldResolver) Type added in v0.17.0

func (fields FieldResolver) Type(expr sqlparser.Expr) (Type, bool)

type FilterExpr added in v0.17.0

type FilterExpr interface {
	BinaryExpr
	// contains filtered or unexported methods
}

type HashCode added in v0.13.0

type HashCode = uint64

HashCode is a type alias to the code easier to read

func NullsafeHashcode added in v0.9.0

func NullsafeHashcode(v sqltypes.Value, collation collations.ID, coerceType sqltypes.Type, sqlmode SQLMode) (HashCode, error)

NullsafeHashcode returns an int64 hashcode that is guaranteed to be the same for two values that are considered equal by `NullsafeCompare`.

type IR added in v0.19.0

type IR interface {
	// contains filtered or unexported methods
}

IR is the interface that all evaluation nodes must implement. It can only be used to match the AST of the compiled expression for planning purposes. IR objects cannot be evaluated directly.

type InExpr added in v0.13.0

type InExpr struct {
	BinaryExpr
	Negate bool
}

func (*InExpr) CachedSize added in v0.13.0

func (cached *InExpr) CachedSize(alloc bool) int64

type IntervalExpr added in v0.17.0

type IntervalExpr struct {
	CallExpr
}

func (*IntervalExpr) CachedSize added in v0.17.0

func (cached *IntervalExpr) CachedSize(alloc bool) int64

type IntroducerExpr added in v0.17.2

type IntroducerExpr struct {
	UnaryExpr
	TypedCollation collations.TypedCollation
	CollationEnv   *collations.Environment
}

func (*IntroducerExpr) CachedSize added in v0.17.2

func (cached *IntroducerExpr) CachedSize(alloc bool) int64

type IsExpr added in v0.13.0

type IsExpr struct {
	UnaryExpr
	Op    sqlparser.IsExprOperator
	Check func(eval) bool
}

IsExpr represents the IS expression in MySQL. boolean_primary IS [NOT] {TRUE | FALSE | NULL}

func (*IsExpr) CachedSize added in v0.13.0

func (cached *IsExpr) CachedSize(alloc bool) int64

type LikeExpr added in v0.13.0

type LikeExpr struct {
	BinaryExpr
	Negate         bool
	Match          colldata.WildcardPattern
	MatchCollation collations.ID
}

func (*LikeExpr) CachedSize added in v0.13.0

func (cached *LikeExpr) CachedSize(alloc bool) int64

type Literal

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

func NewLiteralBinary added in v0.14.0

func NewLiteralBinary(val []byte) *Literal

func NewLiteralBinaryFromBit added in v0.17.0

func NewLiteralBinaryFromBit(val []byte) (*Literal, error)

func NewLiteralBinaryFromHex added in v0.13.0

func NewLiteralBinaryFromHex(val []byte) (*Literal, error)

func NewLiteralBinaryFromHexNum added in v0.13.0

func NewLiteralBinaryFromHexNum(val []byte) (*Literal, error)

func NewLiteralBool added in v0.17.0

func NewLiteralBool(b bool) *Literal

func NewLiteralDateFromBytes added in v0.15.0

func NewLiteralDateFromBytes(val []byte) (*Literal, error)

NewLiteralDateFromBytes returns a literal expression.

func NewLiteralDatetimeFromBytes added in v0.15.0

func NewLiteralDatetimeFromBytes(val []byte) (*Literal, error)

NewLiteralDatetimeFromBytes returns a literal expression. it validates the datetime by parsing it and checking the error.

func NewLiteralDecimalFromBytes added in v0.13.0

func NewLiteralDecimalFromBytes(val []byte) (*Literal, error)

func NewLiteralFloat

func NewLiteralFloat(val float64) *Literal

NewLiteralFloat returns a literal expression

func NewLiteralFloatFromBytes added in v0.13.0

func NewLiteralFloatFromBytes(val []byte) (*Literal, error)

NewLiteralFloatFromBytes returns a float literal expression from a slice of bytes

func NewLiteralInt

func NewLiteralInt(i int64) *Literal

NewLiteralInt returns a literal expression

func NewLiteralIntegralFromBytes added in v0.13.0

func NewLiteralIntegralFromBytes(val []byte) (*Literal, error)

NewLiteralIntegralFromBytes returns a literal expression. It tries to return an int64, but if the value is too large, it tries with an uint64

func NewLiteralString

func NewLiteralString(val []byte, collation collations.TypedCollation) *Literal

NewLiteralString returns a literal expression

func NewLiteralTimeFromBytes added in v0.15.0

func NewLiteralTimeFromBytes(val []byte) (*Literal, error)

NewLiteralTimeFromBytes returns a literal expression. it validates the time by parsing it and checking the error.

func NewLiteralUint added in v0.13.0

func NewLiteralUint(i uint64) *Literal

NewLiteralUint returns a literal expression

func (*Literal) CachedSize added in v0.10.0

func (cached *Literal) CachedSize(alloc bool) int64

func (*Literal) Format added in v0.19.0

func (l *Literal) Format(buf *sqlparser.TrackedBuffer)

func (*Literal) FormatFast added in v0.19.0

func (l *Literal) FormatFast(buf *sqlparser.TrackedBuffer)

func (*Literal) IR added in v0.19.0

func (l *Literal) IR() IR

func (*Literal) IsExpr added in v0.19.0

func (l *Literal) IsExpr()

type LogicalExpr added in v0.13.0

type LogicalExpr struct {
	BinaryExpr
	// contains filtered or unexported fields
}

func (*LogicalExpr) CachedSize added in v0.13.0

func (cached *LogicalExpr) CachedSize(alloc bool) int64

type Merger added in v0.19.0

type Merger struct {
	Compare Comparison
	// contains filtered or unexported fields
}

func (*Merger) Init added in v0.19.0

func (m *Merger) Init()

func (*Merger) Len added in v0.19.0

func (m *Merger) Len() int

func (*Merger) Pop added in v0.19.0

func (m *Merger) Pop() (sqltypes.Row, int)

func (*Merger) Push added in v0.19.0

func (m *Merger) Push(row sqltypes.Row, source int)

type MinMax added in v0.18.0

type MinMax interface {
	Min(value sqltypes.Value) error
	Max(value sqltypes.Value) error
	Result() sqltypes.Value
	Reset()
}

MinMax implements a MIN() or MAX() aggregation

func NewAggregationMinMax added in v0.18.0

func NewAggregationMinMax(typ sqltypes.Type, collationEnv *collations.Environment, collation collations.ID) MinMax

type NegateExpr added in v0.13.0

type NegateExpr struct {
	UnaryExpr
}

func (*NegateExpr) CachedSize added in v0.13.1

func (cached *NegateExpr) CachedSize(alloc bool) int64

type NotExpr added in v0.13.0

type NotExpr struct {
	UnaryExpr
}

func (*NotExpr) CachedSize added in v0.13.0

func (cached *NotExpr) CachedSize(alloc bool) int64

type OrderByParams added in v0.19.0

type OrderByParams struct {
	Col int
	// WeightStringCol is the weight_string column that will be used for sorting.
	// It is set to -1 if such a column is not added to the query
	WeightStringCol int
	Desc            bool

	// Type for knowing if the collation is relevant
	Type Type

	CollationEnv *collations.Environment
}

OrderByParams specifies the parameters for ordering. This is used for merge-sorting scatter queries.

func (*OrderByParams) CachedSize added in v0.19.0

func (cached *OrderByParams) CachedSize(alloc bool) int64

func (*OrderByParams) Compare added in v0.19.0

func (obp *OrderByParams) Compare(r1, r2 []sqltypes.Value) int

func (*OrderByParams) String added in v0.19.0

func (obp *OrderByParams) String() string

String returns a string. Used for plan descriptions

type SQLMode added in v0.19.0

type SQLMode uint32

func ParseSQLMode added in v0.19.0

func ParseSQLMode(sqlmode string) SQLMode

func (SQLMode) AllowZeroDate added in v0.19.0

func (mode SQLMode) AllowZeroDate() bool

type Sorter added in v0.19.0

type Sorter struct {
	Compare Comparison
	Limit   int
	// contains filtered or unexported fields
}

func (*Sorter) Len added in v0.19.0

func (s *Sorter) Len() int

func (*Sorter) Push added in v0.19.0

func (s *Sorter) Push(row sqltypes.Row)

func (*Sorter) Sorted added in v0.19.0

func (s *Sorter) Sorted() []sqltypes.Row

type Sum added in v0.18.0

type Sum interface {
	Add(value sqltypes.Value) error
	Result() sqltypes.Value
	Reset()
}

Sum implements a SUM() aggregation

func NewAggregationSum added in v0.18.0

func NewAggregationSum(type_ sqltypes.Type) Sum

func NewSumOfCounts added in v0.18.0

func NewSumOfCounts() Sum

type TupleBindVariable added in v0.19.0

type TupleBindVariable struct {
	Key string

	Index     int
	Type      sqltypes.Type
	Collation collations.ID
	// contains filtered or unexported fields
}

func (*TupleBindVariable) CachedSize added in v0.19.0

func (cached *TupleBindVariable) CachedSize(alloc bool) int64

func (*TupleBindVariable) Format added in v0.19.0

func (bv *TupleBindVariable) Format(buf *sqlparser.TrackedBuffer)

func (*TupleBindVariable) FormatFast added in v0.19.0

func (bv *TupleBindVariable) FormatFast(buf *sqlparser.TrackedBuffer)

func (*TupleBindVariable) IR added in v0.19.0

func (bv *TupleBindVariable) IR() IR

func (*TupleBindVariable) IsExpr added in v0.19.0

func (bv *TupleBindVariable) IsExpr()

type TupleExpr added in v0.13.0

type TupleExpr []IR

func NewTupleExpr added in v0.13.0

func NewTupleExpr(exprs ...IR) TupleExpr

NewTupleExpr returns a tuple expression

func (TupleExpr) Format added in v0.19.0

func (tuple TupleExpr) Format(buf *sqlparser.TrackedBuffer)

func (TupleExpr) FormatFast added in v0.19.0

func (tuple TupleExpr) FormatFast(buf *sqlparser.TrackedBuffer)

func (TupleExpr) IR added in v0.19.0

func (tuple TupleExpr) IR() IR

func (TupleExpr) IsExpr added in v0.19.0

func (tuple TupleExpr) IsExpr()

type Type added in v0.19.0

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

func AggregateEvalTypes added in v0.19.0

func AggregateEvalTypes(types []Type, env *collations.Environment) (Type, error)

func CoerceTypes added in v0.19.0

func CoerceTypes(v1, v2 Type, collationEnv *collations.Environment) (out Type, err error)

CoerceTypes takes two input types, and decides how they should be coerced before compared

func NewType added in v0.19.0

func NewType(t sqltypes.Type, collation collations.ID) Type

func NewTypeEx added in v0.19.0

func NewTypeEx(t sqltypes.Type, collation collations.ID, nullable bool, size, scale int32) Type

func (*Type) Collation added in v0.19.0

func (t *Type) Collation() collations.ID

func (*Type) Nullable added in v0.19.0

func (t *Type) Nullable() bool

func (*Type) Scale added in v0.19.0

func (t *Type) Scale() int32

func (*Type) Size added in v0.19.0

func (t *Type) Size() int32

func (*Type) Type added in v0.19.0

func (t *Type) Type() sqltypes.Type

func (*Type) Valid added in v0.19.0

func (t *Type) Valid() bool

type TypeResolver added in v0.17.0

type TypeResolver func(expr sqlparser.Expr) (Type, bool)

type UnaryExpr added in v0.13.0

type UnaryExpr struct {
	Inner IR
}

func (*UnaryExpr) CachedSize added in v0.13.0

func (cached *UnaryExpr) CachedSize(alloc bool) int64

type UnsupportedCollationError added in v0.13.0

type UnsupportedCollationError struct {
	ID collations.ID
}

UnsupportedCollationError represents the error where the comparison using provided collation is unsupported on vitess

func (UnsupportedCollationError) Error added in v0.13.0

func (err UnsupportedCollationError) Error() string

Error function implements the error interface

type UntypedExpr added in v0.19.0

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

UntypedExpr is a translated expression that cannot be compiled ahead of time because it contains dynamic types.

func (*UntypedExpr) CachedSize added in v0.19.0

func (cached *UntypedExpr) CachedSize(alloc bool) int64

func (*UntypedExpr) Compile added in v0.19.0

func (u *UntypedExpr) Compile(env *ExpressionEnv) (*CompiledExpr, error)

func (*UntypedExpr) Format added in v0.19.0

func (u *UntypedExpr) Format(buf *sqlparser.TrackedBuffer)

func (*UntypedExpr) FormatFast added in v0.19.0

func (u *UntypedExpr) FormatFast(buf *sqlparser.TrackedBuffer)

func (*UntypedExpr) IR added in v0.19.0

func (u *UntypedExpr) IR() IR

func (*UntypedExpr) IsExpr added in v0.19.0

func (u *UntypedExpr) IsExpr()

type VCursor added in v0.17.0

type VCursor interface {
	TimeZone() *time.Location
	GetKeyspace() string
	SQLMode() string
	Environment() *vtenv.Environment
}

func NewEmptyVCursor added in v0.19.0

func NewEmptyVCursor(env *vtenv.Environment, tz *time.Location) VCursor

type WhenThen added in v0.14.0

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

func (*WhenThen) CachedSize added in v0.14.0

func (cached *WhenThen) CachedSize(alloc bool) int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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