Documentation
¶
Index ¶
- Variables
- func NewArrayLength(array sql.Expression) sql.Expression
- func NewConcat(args ...sql.Expression) (sql.Expression, error)
- func NewDay(date sql.Expression) sql.Expression
- func NewDayOfYear(date sql.Expression) sql.Expression
- func NewHour(date sql.Expression) sql.Expression
- func NewIsBinary(e sql.Expression) sql.Expression
- func NewMinute(date sql.Expression) sql.Expression
- func NewMonth(date sql.Expression) sql.Expression
- func NewSecond(date sql.Expression) sql.Expression
- func NewSplit(str, delimiter sql.Expression) sql.Expression
- func NewSubstring(args ...sql.Expression) (sql.Expression, error)
- func NewVersion(versionPostfix string) func(...sql.Expression) (sql.Expression, error)
- func NewYear(date sql.Expression) sql.Expression
- type ArrayLength
- type Concat
- func (f *Concat) Children() []sql.Expression
- func (f *Concat) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (f *Concat) IsNullable() bool
- func (f *Concat) Resolved() bool
- func (f *Concat) String() string
- func (f *Concat) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)
- func (f *Concat) Type() sql.Type
- type Day
- type DayOfYear
- type Hour
- type IsBinary
- type Minute
- type Month
- type Second
- type Split
- type Substring
- func (s *Substring) Children() []sql.Expression
- func (s *Substring) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (s *Substring) IsNullable() bool
- func (s *Substring) Resolved() bool
- func (s *Substring) String() string
- func (s *Substring) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
- func (*Substring) Type() sql.Type
- type Version
- func (f Version) Children() []sql.Expression
- func (f Version) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (f Version) IsNullable() bool
- func (f Version) Resolved() bool
- func (f Version) String() string
- func (f Version) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)
- func (f Version) Type() sql.Type
- type Year
Constants ¶
This section is empty.
Variables ¶
var Defaults = sql.Functions{ "count": sql.Function1(func(e sql.Expression) sql.Expression { return aggregation.NewCount(e) }), "min": sql.Function1(func(e sql.Expression) sql.Expression { return aggregation.NewMin(e) }), "max": sql.Function1(func(e sql.Expression) sql.Expression { return aggregation.NewMax(e) }), "avg": sql.Function1(func(e sql.Expression) sql.Expression { return aggregation.NewAvg(e) }), "sum": sql.Function1(func(e sql.Expression) sql.Expression { return aggregation.NewSum(e) }), "is_binary": sql.Function1(NewIsBinary), "substring": sql.FunctionN(NewSubstring), "year": sql.Function1(NewYear), "month": sql.Function1(NewMonth), "day": sql.Function1(NewDay), "hour": sql.Function1(NewHour), "minute": sql.Function1(NewMinute), "second": sql.Function1(NewSecond), "dayofyear": sql.Function1(NewDayOfYear), "array_length": sql.Function1(NewArrayLength), "split": sql.Function2(NewSplit), "concat": sql.FunctionN(NewConcat), }
Defaults is the function map with all the default functions.
var ErrConcatArrayWithOthers = errors.NewKind("can't concat a string array with any other elements")
ErrConcatArrayWithOthers is returned when there are more than 1 argument in concat and any of them is an array.
Functions ¶
func NewArrayLength ¶
func NewArrayLength(array sql.Expression) sql.Expression
NewArrayLength creates a new ArrayLength UDF.
func NewConcat ¶
func NewConcat(args ...sql.Expression) (sql.Expression, error)
NewConcat creates a new Concat UDF.
func NewDayOfYear ¶
func NewDayOfYear(date sql.Expression) sql.Expression
NewDayOfYear creates a new DayOfYear UDF.
func NewIsBinary ¶
func NewIsBinary(e sql.Expression) sql.Expression
NewIsBinary creates a new IsBinary expression.
func NewMinute ¶
func NewMinute(date sql.Expression) sql.Expression
NewMinute creates a new Minute UDF.
func NewSecond ¶
func NewSecond(date sql.Expression) sql.Expression
NewSecond creates a new Second UDF.
func NewSplit ¶
func NewSplit(str, delimiter sql.Expression) sql.Expression
NewSplit creates a new Split UDF.
func NewSubstring ¶
func NewSubstring(args ...sql.Expression) (sql.Expression, error)
NewSubstring creates a new substring UDF.
func NewVersion ¶
func NewVersion(versionPostfix string) func(...sql.Expression) (sql.Expression, error)
NewVersion creates a new Version UDF.
Types ¶
type ArrayLength ¶
type ArrayLength struct {
expression.UnaryExpression
}
ArrayLength returns the length of an array.
func (*ArrayLength) String ¶
func (f *ArrayLength) String() string
func (*ArrayLength) TransformUp ¶
func (f *ArrayLength) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
func (*ArrayLength) Type ¶
func (*ArrayLength) Type() sql.Type
Type implements the Expression interface.
type Concat ¶
type Concat struct {
// contains filtered or unexported fields
}
Concat joins several strings together.
func (*Concat) Children ¶
func (f *Concat) Children() []sql.Expression
Children implements the Expression interface.
func (*Concat) IsNullable ¶
IsNullable implements the Expression interface.
func (*Concat) TransformUp ¶
func (f *Concat) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Day ¶
type Day struct {
expression.UnaryExpression
}
Day is a function that returns the day of a date.
func (*Day) TransformUp ¶
func (d *Day) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type DayOfYear ¶
type DayOfYear struct {
expression.UnaryExpression
}
DayOfYear is a function that returns the day of the year from a date.
func (*DayOfYear) TransformUp ¶
func (d *DayOfYear) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Hour ¶
type Hour struct {
expression.UnaryExpression
}
Hour is a function that returns the hour of a date.
func (*Hour) TransformUp ¶
func (h *Hour) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type IsBinary ¶
type IsBinary struct {
expression.UnaryExpression
}
IsBinary is a function that returns whether a blob is binary or not.
func (*IsBinary) TransformUp ¶
func (ib *IsBinary) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Minute ¶
type Minute struct {
expression.UnaryExpression
}
Minute is a function that returns the minute of a date.
func (*Minute) TransformUp ¶
func (m *Minute) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Month ¶
type Month struct {
expression.UnaryExpression
}
Month is a function that returns the month of a date.
func (*Month) TransformUp ¶
func (m *Month) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Second ¶
type Second struct {
expression.UnaryExpression
}
Second is a function that returns the second of a date.
func (*Second) TransformUp ¶
func (s *Second) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Split ¶
type Split struct {
expression.BinaryExpression
}
Split receives a string and returns the parts of it splitted by a delimiter.
func (*Split) IsNullable ¶
IsNullable implements the Expression interface.
func (*Split) TransformUp ¶
func (f *Split) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Substring ¶
type Substring struct {
// contains filtered or unexported fields
}
Substring is a function to return a part of a string. This function behaves as the homonym MySQL function. Since Go strings are UTF8, this function does not return a direct sub string str[start:start+length], instead returns the substring of rune s. That is, "á"[0:1] does not return a partial unicode glyph, but "á" itself.
func (*Substring) Children ¶
func (s *Substring) Children() []sql.Expression
Children implements the Expression interface.
func (*Substring) IsNullable ¶
IsNullable implements the Expression interface.
func (*Substring) TransformUp ¶
func (s *Substring) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Version ¶
type Version string
Version is a function that returns server version.
func (Version) Children ¶
func (f Version) Children() []sql.Expression
Children implements the Expression interface.
func (Version) IsNullable ¶
IsNullable implements the Expression interface.
func (Version) TransformUp ¶
func (f Version) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.
type Year ¶
type Year struct {
expression.UnaryExpression
}
Year is a function that returns the year of a date.
func (*Year) TransformUp ¶
func (y *Year) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)
TransformUp implements the Expression interface.