Documentation ¶
Index ¶
- Constants
- Variables
- func Inspect(expr sql.Expression, f func(sql.Expression) bool)
- func IsBinary(e sql.Expression) bool
- func IsUnary(e sql.Expression) bool
- func JoinAnd(exprs ...sql.Expression) sql.Expression
- func NewAnd(left, right sql.Expression) sql.Expression
- func NewLike(left, right sql.Expression) sql.Expression
- func NewOr(left, right sql.Expression) sql.Expression
- func Walk(v Visitor, expr sql.Expression)
- type Alias
- type And
- type Arithmetic
- func NewArithmetic(left, right sql.Expression, op string) *Arithmetic
- func NewBitAnd(left, right sql.Expression) *Arithmetic
- func NewBitOr(left, right sql.Expression) *Arithmetic
- func NewBitXor(left, right sql.Expression) *Arithmetic
- func NewDiv(left, right sql.Expression) *Arithmetic
- func NewIntDiv(left, right sql.Expression) *Arithmetic
- func NewMinus(left, right sql.Expression) *Arithmetic
- func NewMod(left, right sql.Expression) *Arithmetic
- func NewMult(left, right sql.Expression) *Arithmetic
- func NewPlus(left, right sql.Expression) *Arithmetic
- func NewShiftLeft(left, right sql.Expression) *Arithmetic
- func NewShiftRight(left, right sql.Expression) *Arithmetic
- type Between
- func (b *Between) Children() []sql.Expression
- func (b *Between) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (b *Between) IsNullable() bool
- func (b *Between) Resolved() bool
- func (b *Between) String() string
- func (b *Between) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*Between) Type() sql.Type
- type BinaryExpression
- type Case
- func (c *Case) Children() []sql.Expression
- func (c *Case) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *Case) IsNullable() bool
- func (c *Case) Resolved() bool
- func (c *Case) String() string
- func (c *Case) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (c *Case) Type() sql.Type
- type CaseBranch
- type Comparer
- type Convert
- type DefaultColumn
- func (*DefaultColumn) Children() []sql.Expression
- func (*DefaultColumn) Eval(ctx *sql.Context, r sql.Row) (interface{}, error)
- func (*DefaultColumn) IsNullable() bool
- func (c *DefaultColumn) Name() string
- func (*DefaultColumn) Resolved() bool
- func (c *DefaultColumn) String() string
- func (c *DefaultColumn) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*DefaultColumn) Type() sql.Type
- type Equals
- func (c *Equals) Compare(ctx *sql.Context, row sql.Row) (int, error)
- func (e *Equals) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *Equals) Left() sql.Expression
- func (c *Equals) Right() sql.Expression
- func (e *Equals) String() string
- func (e *Equals) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*Equals) Type() sql.Type
- type GetField
- func (*GetField) Children() []sql.Expression
- func (p *GetField) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (p *GetField) Index() int
- func (p *GetField) IsNullable() bool
- func (p *GetField) Name() string
- func (p *GetField) Resolved() bool
- func (p *GetField) String() string
- func (p *GetField) Table() string
- func (p *GetField) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (p *GetField) Type() sql.Type
- func (p *GetField) WithIndex(n int) sql.Expression
- type GetSessionField
- func (f *GetSessionField) Children() []sql.Expression
- func (f *GetSessionField) Eval(*sql.Context, sql.Row) (interface{}, error)
- func (f *GetSessionField) IsNullable() bool
- func (f *GetSessionField) Resolved() bool
- func (f *GetSessionField) String() string
- func (f *GetSessionField) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)
- func (f *GetSessionField) Type() sql.Type
- type GreaterThan
- func (c *GreaterThan) Compare(ctx *sql.Context, row sql.Row) (int, error)
- func (gt *GreaterThan) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *GreaterThan) Left() sql.Expression
- func (c *GreaterThan) Right() sql.Expression
- func (gt *GreaterThan) String() string
- func (gt *GreaterThan) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*GreaterThan) Type() sql.Type
- type GreaterThanOrEqual
- func (c *GreaterThanOrEqual) Compare(ctx *sql.Context, row sql.Row) (int, error)
- func (gte *GreaterThanOrEqual) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *GreaterThanOrEqual) Left() sql.Expression
- func (c *GreaterThanOrEqual) Right() sql.Expression
- func (gte *GreaterThanOrEqual) String() string
- func (gte *GreaterThanOrEqual) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*GreaterThanOrEqual) Type() sql.Type
- type In
- func (in *In) Children() []sql.Expression
- func (c *In) Compare(ctx *sql.Context, row sql.Row) (int, error)
- func (in *In) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *In) Left() sql.Expression
- func (c *In) Right() sql.Expression
- func (in *In) String() string
- func (in *In) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*In) Type() sql.Type
- type IsNull
- type LessThan
- func (c *LessThan) Compare(ctx *sql.Context, row sql.Row) (int, error)
- func (lt *LessThan) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *LessThan) Left() sql.Expression
- func (c *LessThan) Right() sql.Expression
- func (lt *LessThan) String() string
- func (lt *LessThan) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*LessThan) Type() sql.Type
- type LessThanOrEqual
- func (c *LessThanOrEqual) Compare(ctx *sql.Context, row sql.Row) (int, error)
- func (lte *LessThanOrEqual) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *LessThanOrEqual) Left() sql.Expression
- func (c *LessThanOrEqual) Right() sql.Expression
- func (lte *LessThanOrEqual) String() string
- func (lte *LessThanOrEqual) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*LessThanOrEqual) Type() sql.Type
- type Like
- type Literal
- func (*Literal) Children() []sql.Expression
- func (p *Literal) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (p *Literal) IsNullable() bool
- func (p *Literal) Resolved() bool
- func (p *Literal) String() string
- func (p *Literal) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (p *Literal) Type() sql.Type
- func (p *Literal) Value() interface{}
- type Not
- type NotIn
- func (in *NotIn) Children() []sql.Expression
- func (c *NotIn) Compare(ctx *sql.Context, row sql.Row) (int, error)
- func (in *NotIn) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *NotIn) Left() sql.Expression
- func (c *NotIn) Right() sql.Expression
- func (in *NotIn) String() string
- func (in *NotIn) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*NotIn) Type() sql.Type
- type Or
- type Regexp
- func (c *Regexp) Compare(ctx *sql.Context, row sql.Row) (int, error)
- func (re *Regexp) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *Regexp) Left() sql.Expression
- func (c *Regexp) Right() sql.Expression
- func (re *Regexp) String() string
- func (re *Regexp) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*Regexp) Type() sql.Type
- type Star
- func (*Star) Children() []sql.Expression
- func (*Star) Eval(ctx *sql.Context, r sql.Row) (interface{}, error)
- func (*Star) IsNullable() bool
- func (*Star) Resolved() bool
- func (s *Star) String() string
- func (s *Star) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*Star) Type() sql.Type
- type Tuple
- func (t Tuple) Children() []sql.Expression
- func (t Tuple) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (t Tuple) IsNullable() bool
- func (t Tuple) Resolved() bool
- func (t Tuple) String() string
- func (t Tuple) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (t Tuple) Type() sql.Type
- type UnaryExpression
- type UnaryMinus
- type UnresolvedColumn
- func (*UnresolvedColumn) Children() []sql.Expression
- func (*UnresolvedColumn) Eval(ctx *sql.Context, r sql.Row) (interface{}, error)
- func (*UnresolvedColumn) IsNullable() bool
- func (uc *UnresolvedColumn) Name() string
- func (*UnresolvedColumn) Resolved() bool
- func (uc *UnresolvedColumn) String() string
- func (uc *UnresolvedColumn) Table() string
- func (uc *UnresolvedColumn) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*UnresolvedColumn) Type() sql.Type
- type UnresolvedFunction
- func (uf *UnresolvedFunction) Children() []sql.Expression
- func (*UnresolvedFunction) Eval(ctx *sql.Context, r sql.Row) (interface{}, error)
- func (*UnresolvedFunction) IsNullable() bool
- func (uf *UnresolvedFunction) Name() string
- func (*UnresolvedFunction) Resolved() bool
- func (uf *UnresolvedFunction) String() string
- func (uf *UnresolvedFunction) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*UnresolvedFunction) Type() sql.Type
- type Visitor
Constants ¶
const ( // ConvertToBinary is a conversion to binary. ConvertToBinary = "binary" // ConvertToChar is a conversion to char. ConvertToChar = "char" // ConvertToNChar is a conversion to nchar. ConvertToNChar = "nchar" // ConvertToDate is a conversion to date. ConvertToDate = "date" // ConvertToDatetime is a conversion to datetune. ConvertToDatetime = "datetime" // ConvertToDecimal is a conversion to decimal. ConvertToDecimal = "decimal" // ConvertToJSON is a conversion to json. ConvertToJSON = "json" // ConvertToSigned is a conversion to signed. ConvertToSigned = "signed" // ConvertToUnsigned is a conversion to unsigned. ConvertToUnsigned = "unsigned" )
Variables ¶
var ( // ErrUnsupportedInOperand is returned when there is an invalid righthand // operand in an IN operator. ErrUnsupportedInOperand = errors.NewKind("right operand in IN operation must be tuple, but is %T") // ErrInvalidOperandColumns is returned when the columns in the left operand // and the elements of the right operand don't match. ErrInvalidOperandColumns = errors.NewKind("operand should have %d columns, but has %d") )
var ErrConvertExpression = errors.NewKind("expression '%v': couldn't convert to %v")
ErrConvertExpression is returned when a conversion is not possible.
var ErrIndexOutOfBounds = errors.NewKind("unable to find field with index %d in row of %d columns")
ErrIndexOutOfBounds is returned when the field index is out of the bounds.
var ErrNilOperand = errors.NewKind("nil operand found in comparison")
ErrNilOperand ir returned if some or both of the comparison's operands is nil.
Functions ¶
func Inspect ¶
func Inspect(expr sql.Expression, f func(sql.Expression) bool)
Inspect traverses the plan in depth-first order: It starts by calling f(expr); expr must not be nil. If f returns true, Inspect invokes f recursively for each of the children of expr, followed by a call of f(nil).
func IsBinary ¶
func IsBinary(e sql.Expression) bool
IsBinary returns whether the expression is binary or not.
func IsUnary ¶
func IsUnary(e sql.Expression) bool
IsUnary returns whether the expression is unary or not.
func JoinAnd ¶
func JoinAnd(exprs ...sql.Expression) sql.Expression
JoinAnd joins several expressions with And.
func NewAnd ¶
func NewAnd(left, right sql.Expression) sql.Expression
NewAnd creates a new And expression.
func NewLike ¶ added in v0.2.0
func NewLike(left, right sql.Expression) sql.Expression
NewLike creates a new LIKE expression.
func NewOr ¶
func NewOr(left, right sql.Expression) sql.Expression
NewOr creates a new Or expression.
func Walk ¶
func Walk(v Visitor, expr sql.Expression)
Walk traverses the plan tree in depth-first order. It starts by calling v.Visit(expr); expr must not be nil. If the visitor returned by v.Visit(expr) is not nil, Walk is invoked recursively with the returned visitor for each children of the expr, followed by a call of v.Visit(nil) to the returned visitor.
Types ¶
type Alias ¶
type Alias struct { UnaryExpression // contains filtered or unexported fields }
Alias is a node that gives a name to an expression.
func NewAlias ¶
func NewAlias(child sql.Expression, name string) *Alias
NewAlias returns a new Alias node.
func (*Alias) TransformUp ¶
func (e *Alias) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type And ¶
type And struct {
BinaryExpression
}
And checks whether two expressions are true.
func (*And) TransformUp ¶
func (a *And) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Arithmetic ¶
type Arithmetic struct { BinaryExpression // contains filtered or unexported fields }
Arithmetic expressions (+, -, *, /, ...)
func NewArithmetic ¶
func NewArithmetic(left, right sql.Expression, op string) *Arithmetic
NewArithmetic creates a new Arithmetic sql.Expression.
func NewBitAnd ¶
func NewBitAnd(left, right sql.Expression) *Arithmetic
NewBitAnd creates a new Arithmetic & sql.Expression.
func NewBitOr ¶
func NewBitOr(left, right sql.Expression) *Arithmetic
NewBitOr creates a new Arithmetic | sql.Expression.
func NewBitXor ¶
func NewBitXor(left, right sql.Expression) *Arithmetic
NewBitXor creates a new Arithmetic ^ sql.Expression.
func NewDiv ¶
func NewDiv(left, right sql.Expression) *Arithmetic
NewDiv creates a new Arithmetic / sql.Expression.
func NewIntDiv ¶
func NewIntDiv(left, right sql.Expression) *Arithmetic
NewIntDiv creates a new Arithmetic div sql.Expression.
func NewMinus ¶
func NewMinus(left, right sql.Expression) *Arithmetic
NewMinus creates a new Arithmetic - sql.Expression.
func NewMod ¶
func NewMod(left, right sql.Expression) *Arithmetic
NewMod creates a new Arithmetic % sql.Expression.
func NewMult ¶
func NewMult(left, right sql.Expression) *Arithmetic
NewMult creates a new Arithmetic * sql.Expression.
func NewPlus ¶
func NewPlus(left, right sql.Expression) *Arithmetic
NewPlus creates a new Arithmetic + sql.Expression.
func NewShiftLeft ¶
func NewShiftLeft(left, right sql.Expression) *Arithmetic
NewShiftLeft creates a new Arithmetic << sql.Expression.
func NewShiftRight ¶
func NewShiftRight(left, right sql.Expression) *Arithmetic
NewShiftRight creates a new Arithmetic >> sql.Expression.
func (*Arithmetic) String ¶
func (a *Arithmetic) String() string
func (*Arithmetic) TransformUp ¶
func (a *Arithmetic) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
func (*Arithmetic) Type ¶
func (a *Arithmetic) Type() sql.Type
Type returns the greatest type for given operation.
type Between ¶
type Between struct { Val sql.Expression Lower sql.Expression Upper sql.Expression }
Between checks a value is between two given values.
func NewBetween ¶
func NewBetween(val, lower, upper sql.Expression) *Between
NewBetween creates a new Between expression.
func (*Between) Children ¶
func (b *Between) Children() []sql.Expression
Children implements the Expression interface.
func (*Between) IsNullable ¶
IsNullable implements the Expression interface.
func (*Between) TransformUp ¶
func (b *Between) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type BinaryExpression ¶
type BinaryExpression struct { Left sql.Expression Right sql.Expression }
BinaryExpression is an expression that has two children.
func (*BinaryExpression) Children ¶
func (p *BinaryExpression) Children() []sql.Expression
Children implements the Expression interface.
func (*BinaryExpression) IsNullable ¶
func (p *BinaryExpression) IsNullable() bool
IsNullable returns whether the expression can be null.
func (*BinaryExpression) Resolved ¶
func (p *BinaryExpression) Resolved() bool
Resolved implements the Expression interface.
type Case ¶ added in v0.4.0
type Case struct { Expr sql.Expression Branches []CaseBranch Else sql.Expression }
Case is an expression that returns the value of one of its branches when a condition is met.
func NewCase ¶ added in v0.4.0
func NewCase(expr sql.Expression, branches []CaseBranch, elseExpr sql.Expression) *Case
NewCase returns an new Case expression.
func (*Case) Children ¶ added in v0.4.0
func (c *Case) Children() []sql.Expression
Children implements the sql.Expression interface.
func (*Case) IsNullable ¶ added in v0.4.0
IsNullable implements the sql.Expression interface.
func (*Case) TransformUp ¶ added in v0.4.0
func (c *Case) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the sql.Expression interface.
type CaseBranch ¶ added in v0.4.0
type CaseBranch struct { Cond sql.Expression Value sql.Expression }
CaseBranch is a single branch of a case expression.
type Comparer ¶
type Comparer interface { sql.Expression Compare(ctx *sql.Context, row sql.Row) (int, error) Left() sql.Expression Right() sql.Expression }
Comparer implements a comparison expression.
type Convert ¶
type Convert struct { UnaryExpression // contains filtered or unexported fields }
Convert represent a CAST(x AS T) or CONVERT(x, T) operation that casts x expression to type T.
func NewConvert ¶
func NewConvert(expr sql.Expression, castToType string) *Convert
NewConvert creates a new Convert expression.
func (*Convert) TransformUp ¶
func (c *Convert) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type DefaultColumn ¶ added in v0.2.0
type DefaultColumn struct {
// contains filtered or unexported fields
}
DefaultColumn is an default expression of a column that is not yet resolved.
func NewDefaultColumn ¶ added in v0.2.0
func NewDefaultColumn(name string) *DefaultColumn
NewDefaultColumn creates a new NewDefaultColumn expression.
func (*DefaultColumn) Children ¶ added in v0.2.0
func (*DefaultColumn) Children() []sql.Expression
Children implements the sql.Expression interface. The function returns always nil
func (*DefaultColumn) Eval ¶ added in v0.2.0
Eval implements the sql.Expression interface. The function always panics!
func (*DefaultColumn) IsNullable ¶ added in v0.2.0
func (*DefaultColumn) IsNullable() bool
IsNullable implements the sql.Expression interface. The function always panics!
func (*DefaultColumn) Name ¶ added in v0.2.0
func (c *DefaultColumn) Name() string
Name implements the sql.Nameable interface.
func (*DefaultColumn) Resolved ¶ added in v0.2.0
func (*DefaultColumn) Resolved() bool
Resolved implements the sql.Expression interface. The function returns always false
func (*DefaultColumn) String ¶ added in v0.2.0
func (c *DefaultColumn) String() string
String implements the Stringer The function returns column's name (can be an empty string)
func (*DefaultColumn) TransformUp ¶ added in v0.2.0
func (c *DefaultColumn) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the sql.Expression interface.
func (*DefaultColumn) Type ¶ added in v0.2.0
func (*DefaultColumn) Type() sql.Type
Type implements the sql.Expression interface. The function always panics!
type Equals ¶
type Equals struct {
// contains filtered or unexported fields
}
Equals is a comparison that checks an expression is equal to another.
func NewEquals ¶
func NewEquals(left sql.Expression, right sql.Expression) *Equals
NewEquals returns a new Equals expression.
func (*Equals) Compare ¶
Compare the two given values using the types of the expressions in the comparison. Since both types should be equal, it does not matter which type is used, but for reference, the left type is always used.
func (*Equals) TransformUp ¶
func (e *Equals) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type GetField ¶
type GetField struct {
// contains filtered or unexported fields
}
GetField is an expression to get the field of a table.
func NewGetField ¶
NewGetField creates a GetField expression.
func NewGetFieldWithTable ¶
func NewGetFieldWithTable(index int, fieldType sql.Type, table, fieldName string, nullable bool) *GetField
NewGetFieldWithTable creates a GetField expression with table name.
func (*GetField) Children ¶
func (*GetField) Children() []sql.Expression
Children implements the Expression interface.
func (*GetField) Index ¶
Index returns the index where the GetField will look for the value from a sql.Row.
func (*GetField) IsNullable ¶
IsNullable returns whether the field is nullable or not.
func (*GetField) TransformUp ¶
func (p *GetField) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type GetSessionField ¶
type GetSessionField struct {
// contains filtered or unexported fields
}
GetSessionField is an expression that returns the value of a session configuration.
func NewGetSessionField ¶
func NewGetSessionField(name string, typ sql.Type, value interface{}) *GetSessionField
NewGetSessionField creates a new GetSessionField expression.
func (*GetSessionField) Children ¶
func (f *GetSessionField) Children() []sql.Expression
Children implements the sql.Expression interface.
func (*GetSessionField) IsNullable ¶
func (f *GetSessionField) IsNullable() bool
IsNullable implements the sql.Expression interface.
func (*GetSessionField) Resolved ¶
func (f *GetSessionField) Resolved() bool
Resolved implements the sql.Expression interface.
func (*GetSessionField) String ¶
func (f *GetSessionField) String() string
String implements the sql.Expression interface.
func (*GetSessionField) TransformUp ¶
func (f *GetSessionField) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the sql.Expression interface.
func (*GetSessionField) Type ¶
func (f *GetSessionField) Type() sql.Type
Type implements the sql.Expression interface.
type GreaterThan ¶
type GreaterThan struct {
// contains filtered or unexported fields
}
GreaterThan is a comparison that checks an expression is greater than another.
func NewGreaterThan ¶
func NewGreaterThan(left sql.Expression, right sql.Expression) *GreaterThan
NewGreaterThan creates a new GreaterThan expression.
func (*GreaterThan) Compare ¶
Compare the two given values using the types of the expressions in the comparison. Since both types should be equal, it does not matter which type is used, but for reference, the left type is always used.
func (*GreaterThan) Left ¶
func (c *GreaterThan) Left() sql.Expression
Left implements Comparer interface
func (*GreaterThan) Right ¶
func (c *GreaterThan) Right() sql.Expression
Right implements Comparer interface
func (*GreaterThan) String ¶
func (gt *GreaterThan) String() string
func (*GreaterThan) TransformUp ¶
func (gt *GreaterThan) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type GreaterThanOrEqual ¶
type GreaterThanOrEqual struct {
// contains filtered or unexported fields
}
GreaterThanOrEqual is a comparison that checks an expression is greater or equal to another.
func NewGreaterThanOrEqual ¶
func NewGreaterThanOrEqual(left sql.Expression, right sql.Expression) *GreaterThanOrEqual
NewGreaterThanOrEqual creates a new GreaterThanOrEqual
func (*GreaterThanOrEqual) Compare ¶
Compare the two given values using the types of the expressions in the comparison. Since both types should be equal, it does not matter which type is used, but for reference, the left type is always used.
func (*GreaterThanOrEqual) Left ¶
func (c *GreaterThanOrEqual) Left() sql.Expression
Left implements Comparer interface
func (*GreaterThanOrEqual) Right ¶
func (c *GreaterThanOrEqual) Right() sql.Expression
Right implements Comparer interface
func (*GreaterThanOrEqual) String ¶
func (gte *GreaterThanOrEqual) String() string
func (*GreaterThanOrEqual) TransformUp ¶
func (gte *GreaterThanOrEqual) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type In ¶
type In struct {
// contains filtered or unexported fields
}
In is a comparison that checks an expression is inside a list of expressions.
func NewIn ¶
func NewIn(left sql.Expression, right sql.Expression) *In
NewIn creates a In expression.
func (*In) Children ¶
func (in *In) Children() []sql.Expression
Children implements the Expression interface.
func (*In) Compare ¶
Compare the two given values using the types of the expressions in the comparison. Since both types should be equal, it does not matter which type is used, but for reference, the left type is always used.
func (*In) TransformUp ¶
func (in *In) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type IsNull ¶
type IsNull struct {
UnaryExpression
}
IsNull is an expression that checks if an expression is null.
func NewIsNull ¶
func NewIsNull(child sql.Expression) *IsNull
NewIsNull creates a new IsNull expression.
func (*IsNull) IsNullable ¶
IsNullable implements the Expression interface.
func (*IsNull) TransformUp ¶
func (e *IsNull) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type LessThan ¶
type LessThan struct {
// contains filtered or unexported fields
}
LessThan is a comparison that checks an expression is less than another.
func NewLessThan ¶
func NewLessThan(left sql.Expression, right sql.Expression) *LessThan
NewLessThan creates a new LessThan expression.
func (*LessThan) Compare ¶
Compare the two given values using the types of the expressions in the comparison. Since both types should be equal, it does not matter which type is used, but for reference, the left type is always used.
func (*LessThan) Right ¶
func (c *LessThan) Right() sql.Expression
Right implements Comparer interface
func (*LessThan) TransformUp ¶
func (lt *LessThan) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type LessThanOrEqual ¶
type LessThanOrEqual struct {
// contains filtered or unexported fields
}
LessThanOrEqual is a comparison that checks an expression is equal or lower than another.
func NewLessThanOrEqual ¶
func NewLessThanOrEqual(left sql.Expression, right sql.Expression) *LessThanOrEqual
NewLessThanOrEqual creates a LessThanOrEqual expression.
func (*LessThanOrEqual) Compare ¶
Compare the two given values using the types of the expressions in the comparison. Since both types should be equal, it does not matter which type is used, but for reference, the left type is always used.
func (*LessThanOrEqual) Left ¶
func (c *LessThanOrEqual) Left() sql.Expression
Left implements Comparer interface
func (*LessThanOrEqual) Right ¶
func (c *LessThanOrEqual) Right() sql.Expression
Right implements Comparer interface
func (*LessThanOrEqual) String ¶
func (lte *LessThanOrEqual) String() string
func (*LessThanOrEqual) TransformUp ¶
func (lte *LessThanOrEqual) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Like ¶ added in v0.2.0
type Like struct { BinaryExpression // contains filtered or unexported fields }
Like performs pattern matching against two strings.
func (*Like) TransformUp ¶ added in v0.2.0
func (l *Like) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the sql.Expression interface.
type Literal ¶
type Literal struct {
// contains filtered or unexported fields
}
Literal represents a literal expression (string, number, bool, ...).
func NewLiteral ¶
NewLiteral creates a new Literal expression.
func (*Literal) Children ¶
func (*Literal) Children() []sql.Expression
Children implements the Expression interface.
func (*Literal) IsNullable ¶
IsNullable implements the Expression interface.
func (*Literal) TransformUp ¶
func (p *Literal) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Not ¶
type Not struct {
UnaryExpression
}
Not is a node that negates an expression.
func (*Not) TransformUp ¶
func (e *Not) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type NotIn ¶
type NotIn struct {
// contains filtered or unexported fields
}
NotIn is a comparison that checks an expression is not inside a list of expressions.
func NewNotIn ¶
func NewNotIn(left sql.Expression, right sql.Expression) *NotIn
NewNotIn creates a In expression.
func (*NotIn) Children ¶
func (in *NotIn) Children() []sql.Expression
Children implements the Expression interface.
func (*NotIn) Compare ¶
Compare the two given values using the types of the expressions in the comparison. Since both types should be equal, it does not matter which type is used, but for reference, the left type is always used.
func (*NotIn) TransformUp ¶
func (in *NotIn) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Or ¶
type Or struct {
BinaryExpression
}
Or checks whether one of the two given expressions is true.
func (*Or) TransformUp ¶
func (o *Or) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
Regexp is a comparison that checks an expression matches a regexp.
func NewRegexp ¶
func NewRegexp(left sql.Expression, right sql.Expression) *Regexp
NewRegexp creates a new Regexp expression.
func (*Regexp) Compare ¶
Compare the two given values using the types of the expressions in the comparison. Since both types should be equal, it does not matter which type is used, but for reference, the left type is always used.
func (*Regexp) TransformUp ¶
func (re *Regexp) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Star ¶
type Star struct {
Table string
}
Star represents the selection of all available fields. This is just a placeholder node, it will not actually be evaluated but converted to a series of GetFields when the query is analyzed.
func NewQualifiedStar ¶
NewQualifiedStar returns a new star expression only for a specific table.
func (*Star) Children ¶
func (*Star) Children() []sql.Expression
Children implements the Expression interface.
func (*Star) IsNullable ¶
IsNullable implements the Expression interface.
func (*Star) TransformUp ¶
func (s *Star) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Tuple ¶
type Tuple []sql.Expression
Tuple is a fixed-size collection of expressions. A tuple of size 1 is treated as the expression itself.
func NewTuple ¶
func NewTuple(exprs ...sql.Expression) Tuple
NewTuple creates a new Tuple expression.
func (Tuple) Children ¶
func (t Tuple) Children() []sql.Expression
Children implements the Expression interface.
func (Tuple) IsNullable ¶
IsNullable implements the Expression interface.
func (Tuple) TransformUp ¶
func (t Tuple) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type UnaryExpression ¶
type UnaryExpression struct {
Child sql.Expression
}
UnaryExpression is an expression that has only one children.
func (*UnaryExpression) Children ¶
func (p *UnaryExpression) Children() []sql.Expression
Children implements the Expression interface.
func (*UnaryExpression) IsNullable ¶
func (p *UnaryExpression) IsNullable() bool
IsNullable returns whether the expression can be null.
func (*UnaryExpression) Resolved ¶
func (p *UnaryExpression) Resolved() bool
Resolved implements the Expression interface.
type UnaryMinus ¶ added in v0.2.0
type UnaryMinus struct {
UnaryExpression
}
UnaryMinus is an unary minus operator.
func NewUnaryMinus ¶ added in v0.2.0
func NewUnaryMinus(child sql.Expression) *UnaryMinus
NewUnaryMinus creates a new UnaryMinus expression node.
func (*UnaryMinus) String ¶ added in v0.2.0
func (e *UnaryMinus) String() string
func (*UnaryMinus) TransformUp ¶ added in v0.2.0
func (e *UnaryMinus) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the sql.Expression interface.
func (*UnaryMinus) Type ¶ added in v0.2.0
func (e *UnaryMinus) Type() sql.Type
Type implements the sql.Expression interface.
type UnresolvedColumn ¶
type UnresolvedColumn struct {
// contains filtered or unexported fields
}
UnresolvedColumn is an expression of a column that is not yet resolved. This is a placeholder node, so its methods Type, IsNullable and Eval are not supposed to be called.
func NewUnresolvedColumn ¶
func NewUnresolvedColumn(name string) *UnresolvedColumn
NewUnresolvedColumn creates a new UnresolvedColumn expression.
func NewUnresolvedQualifiedColumn ¶
func NewUnresolvedQualifiedColumn(table, name string) *UnresolvedColumn
NewUnresolvedQualifiedColumn creates a new UnresolvedColumn expression with a table qualifier.
func (*UnresolvedColumn) Children ¶
func (*UnresolvedColumn) Children() []sql.Expression
Children implements the Expression interface.
func (*UnresolvedColumn) IsNullable ¶
func (*UnresolvedColumn) IsNullable() bool
IsNullable implements the Expression interface.
func (*UnresolvedColumn) Name ¶
func (uc *UnresolvedColumn) Name() string
Name implements the Nameable interface.
func (*UnresolvedColumn) Resolved ¶
func (*UnresolvedColumn) Resolved() bool
Resolved implements the Expression interface.
func (*UnresolvedColumn) String ¶
func (uc *UnresolvedColumn) String() string
func (*UnresolvedColumn) Table ¶
func (uc *UnresolvedColumn) Table() string
Table returns the table name.
func (*UnresolvedColumn) TransformUp ¶
func (uc *UnresolvedColumn) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
func (*UnresolvedColumn) Type ¶
func (*UnresolvedColumn) Type() sql.Type
Type implements the Expression interface.
type UnresolvedFunction ¶
type UnresolvedFunction struct { // IsAggregate or not. IsAggregate bool // Children of the expression. Arguments []sql.Expression // contains filtered or unexported fields }
UnresolvedFunction represents a function that is not yet resolved. This is a placeholder node, so its methods Type, IsNullable and Eval are not supposed to be called.
func NewUnresolvedFunction ¶
func NewUnresolvedFunction( name string, agg bool, arguments ...sql.Expression, ) *UnresolvedFunction
NewUnresolvedFunction creates a new UnresolvedFunction expression.
func (*UnresolvedFunction) Children ¶
func (uf *UnresolvedFunction) Children() []sql.Expression
Children implements the Expression interface.
func (*UnresolvedFunction) IsNullable ¶
func (*UnresolvedFunction) IsNullable() bool
IsNullable implements the Expression interface.
func (*UnresolvedFunction) Name ¶
func (uf *UnresolvedFunction) Name() string
Name implements the Nameable interface.
func (*UnresolvedFunction) Resolved ¶
func (*UnresolvedFunction) Resolved() bool
Resolved implements the Expression interface.
func (*UnresolvedFunction) String ¶
func (uf *UnresolvedFunction) String() string
func (*UnresolvedFunction) TransformUp ¶
func (uf *UnresolvedFunction) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
func (*UnresolvedFunction) Type ¶
func (*UnresolvedFunction) Type() sql.Type
Type implements the Expression interface.
type Visitor ¶
type Visitor interface { // Visit method is invoked for each expr encountered by Walk. // If the result Visitor is not nul, Walk visits each of the children // of the expr with that visitor, followed by a call of Visit(nil) // to the returned visitor. Visit(expr sql.Expression) Visitor }
Visitor visits exprs in the plan.