function

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
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),
	"mid":           sql.FunctionN(NewSubstring),
	"substr":        sql.FunctionN(NewSubstring),
	"year":          sql.Function1(NewYear),
	"month":         sql.Function1(NewMonth),
	"day":           sql.Function1(NewDay),
	"weekday":       sql.Function1(NewWeekday),
	"hour":          sql.Function1(NewHour),
	"minute":        sql.Function1(NewMinute),
	"second":        sql.Function1(NewSecond),
	"dayofweek":     sql.Function1(NewDayOfWeek),
	"dayofyear":     sql.Function1(NewDayOfYear),
	"array_length":  sql.Function1(NewArrayLength),
	"split":         sql.Function2(NewSplit),
	"concat":        sql.FunctionN(NewConcat),
	"concat_ws":     sql.FunctionN(NewConcatWithSeparator),
	"coalesce":      sql.FunctionN(NewCoalesce),
	"lower":         sql.Function1(NewLower),
	"upper":         sql.Function1(NewUpper),
	"ceiling":       sql.Function1(NewCeil),
	"ceil":          sql.Function1(NewCeil),
	"floor":         sql.Function1(NewFloor),
	"round":         sql.FunctionN(NewRound),
	"connection_id": sql.Function0(NewConnectionID),
	"soundex":       sql.Function1(NewSoundex),
	"json_extract":  sql.FunctionN(NewJSONExtract),
	"ln":            sql.Function1(NewLogBaseFunc(float64(math.E))),
	"log2":          sql.Function1(NewLogBaseFunc(float64(2))),
	"log10":         sql.Function1(NewLogBaseFunc(float64(10))),
	"log":           sql.FunctionN(NewLog),
	"rpad":          sql.FunctionN(NewPadFunc(rPadType)),
	"lpad":          sql.FunctionN(NewPadFunc(lPadType)),
	"sqrt":          sql.Function1(NewSqrt),
	"pow":           sql.Function2(NewPower),
	"power":         sql.Function2(NewPower),
	"ltrim":         sql.Function1(NewTrimFunc(lTrimType)),
	"rtrim":         sql.Function1(NewTrimFunc(rTrimType)),
	"trim":          sql.Function1(NewTrimFunc(bTrimType)),
	"reverse":       sql.Function1(NewReverse),
	"repeat":        sql.Function2(NewRepeat),
	"replace":       sql.Function3(NewReplace),
	"ifnull":        sql.Function2(NewIfNull),
	"nullif":        sql.Function2(NewNullIf),
	"now":           sql.Function0(NewNow),
}

Defaults is the function map with all the default functions.

View Source
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.

View Source
var ErrDivisionByZero = errors.NewKind("division by zero")
View Source
var ErrInvalidArgumentForLogarithm = errors.NewKind("invalid argument value for logarithm: %v")

ErrInvalidArgumentForLogarithm is returned when an invalid argument value is passed to a logarithm function

View Source
var ErrNegativeRepeatCount = errors.NewKind("negative Repeat count: %v")

Functions

func NewArrayLength

func NewArrayLength(array sql.Expression) sql.Expression

NewArrayLength creates a new ArrayLength UDF.

func NewCeil added in v0.2.0

func NewCeil(num sql.Expression) sql.Expression

NewCeil creates a new Ceil expression.

func NewCoalesce added in v0.2.0

func NewCoalesce(args ...sql.Expression) (sql.Expression, error)

NewCoalesce creates a new Coalesce sql.Expression.

func NewConcat

func NewConcat(args ...sql.Expression) (sql.Expression, error)

NewConcat creates a new Concat UDF.

func NewConcatWithSeparator added in v0.2.0

func NewConcatWithSeparator(args ...sql.Expression) (sql.Expression, error)

NewConcatWithSeparator creates a new NewConcatWithSeparator UDF.

func NewConnectionID added in v0.2.0

func NewConnectionID() sql.Expression

NewConnectionID creates a new ConnectionID UDF node.

func NewDatabase added in v0.2.0

func NewDatabase(c *sql.Catalog) func() sql.Expression

NewDatabase returns a new Database function

func NewDay

func NewDay(date sql.Expression) sql.Expression

NewDay creates a new Day UDF.

func NewDayOfWeek added in v0.2.0

func NewDayOfWeek(date sql.Expression) sql.Expression

NewDayOfWeek creates a new DayOfWeek UDF.

func NewDayOfYear

func NewDayOfYear(date sql.Expression) sql.Expression

NewDayOfYear creates a new DayOfYear UDF.

func NewFloor added in v0.2.0

func NewFloor(num sql.Expression) sql.Expression

NewFloor returns a new Floor expression.

func NewHour

func NewHour(date sql.Expression) sql.Expression

NewHour creates a new Hour UDF.

func NewIfNull added in v0.3.0

func NewIfNull(ex, value sql.Expression) sql.Expression

NewIfNull returns a new IFNULL UDF

func NewIsBinary

func NewIsBinary(e sql.Expression) sql.Expression

NewIsBinary creates a new IsBinary expression.

func NewJSONExtract added in v0.2.0

func NewJSONExtract(args ...sql.Expression) (sql.Expression, error)

NewJSONExtract creates a new JSONExtract UDF.

func NewLog added in v0.2.0

func NewLog(args ...sql.Expression) (sql.Expression, error)

NewLog creates a new Log expression.

func NewLogBase added in v0.2.0

func NewLogBase(base float64, e sql.Expression) sql.Expression

NewLogBase creates a new LogBase expression.

func NewLogBaseFunc added in v0.2.0

func NewLogBaseFunc(base float64) func(e sql.Expression) sql.Expression

NewLogBaseFunc returns LogBase creator function with a specific base.

func NewLower added in v0.2.0

func NewLower(e sql.Expression) sql.Expression

NewLower creates a new Lower expression.

func NewMinute

func NewMinute(date sql.Expression) sql.Expression

NewMinute creates a new Minute UDF.

func NewMonth

func NewMonth(date sql.Expression) sql.Expression

NewMonth creates a new Month UDF.

func NewNow added in v0.3.0

func NewNow() sql.Expression

NewNow returns a new Now node.

func NewNullIf added in v0.3.0

func NewNullIf(ex1, ex2 sql.Expression) sql.Expression

NewNullIf returns a new NULLIF UDF

func NewPad added in v0.2.0

func NewPad(pType padType, args ...sql.Expression) (sql.Expression, error)

NewPad creates a new Pad expression.

func NewPadFunc added in v0.2.0

func NewPadFunc(pType padType) func(e ...sql.Expression) (sql.Expression, error)

NewPadFunc returns a Pad creator function with a specific padType.

func NewPower added in v0.2.0

func NewPower(e1, e2 sql.Expression) sql.Expression

NewPower creates a new Power expression.

func NewRepeat added in v0.2.0

func NewRepeat(str sql.Expression, count sql.Expression) sql.Expression

NewRepeat creates a new Repeat expression.

func NewReplace added in v0.2.0

func NewReplace(str sql.Expression, fromStr sql.Expression, toStr sql.Expression) sql.Expression

NewReplace creates a new Replace expression.

func NewReverse added in v0.2.0

func NewReverse(e sql.Expression) sql.Expression

NewReverse creates a new Reverse expression.

func NewRound added in v0.2.0

func NewRound(args ...sql.Expression) (sql.Expression, error)

NewRound returns a new Round expression.

func NewSecond

func NewSecond(date sql.Expression) sql.Expression

NewSecond creates a new Second UDF.

func NewSoundex added in v0.2.0

func NewSoundex(e sql.Expression) sql.Expression

NewSoundex creates a new Soundex expression.

func NewSplit

func NewSplit(str, delimiter sql.Expression) sql.Expression

NewSplit creates a new Split UDF.

func NewSqrt added in v0.2.0

func NewSqrt(e sql.Expression) sql.Expression

NewSqrt creates a new Sqrt expression.

func NewSubstring

func NewSubstring(args ...sql.Expression) (sql.Expression, error)

NewSubstring creates a new substring UDF.

func NewTrim added in v0.2.0

func NewTrim(tType trimType, str sql.Expression) sql.Expression

NewTrim creates a new Trim expression.

func NewTrimFunc added in v0.2.0

func NewTrimFunc(tType trimType) func(e sql.Expression) sql.Expression

NewTrimFunc returns a Trim creator function with a specific trimType.

func NewUpper added in v0.2.0

func NewUpper(e sql.Expression) sql.Expression

NewUpper creates a new Lower expression.

func NewVersion

func NewVersion(versionPostfix string) func(...sql.Expression) (sql.Expression, error)

NewVersion creates a new Version UDF.

func NewWeekday added in v0.2.0

func NewWeekday(date sql.Expression) sql.Expression

NewWeekday creates a new Weekday UDF.

func NewYear

func NewYear(date sql.Expression) sql.Expression

NewYear creates a new Year UDF.

Types

type ArrayLength

type ArrayLength struct {
	expression.UnaryExpression
}

ArrayLength returns the length of an array.

func (*ArrayLength) Eval

func (f *ArrayLength) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

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 Ceil added in v0.2.0

type Ceil struct {
	expression.UnaryExpression
}

Ceil returns the smallest integer value not less than X.

func (*Ceil) Eval added in v0.2.0

func (c *Ceil) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Ceil) String added in v0.2.0

func (c *Ceil) String() string

func (*Ceil) TransformUp added in v0.2.0

func (c *Ceil) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Ceil) Type added in v0.2.0

func (c *Ceil) Type() sql.Type

Type implements the Expression interface.

type Coalesce added in v0.2.0

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

Coalesce returns the first non-NULL value in the list, or NULL if there are no non-NULL values.

func (*Coalesce) Children added in v0.2.0

func (c *Coalesce) Children() []sql.Expression

Children implements the sql.Expression interface.

func (*Coalesce) Eval added in v0.2.0

func (c *Coalesce) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the sql.Expression interface. The function evaluates the first non-nil argument. If the value is nil, then we keep going, otherwise we return the first non-nil value.

func (*Coalesce) IsNullable added in v0.2.0

func (c *Coalesce) IsNullable() bool

IsNullable implements the sql.Expression interface. Returns true if all arguments are nil or of the first non-nil argument is nullable, otherwise false.

func (*Coalesce) Resolved added in v0.2.0

func (c *Coalesce) Resolved() bool

Resolved implements the sql.Expression interface. The function checks if first non-nil argument is resolved.

func (*Coalesce) String added in v0.2.0

func (c *Coalesce) String() string

func (*Coalesce) TransformUp added in v0.2.0

func (c *Coalesce) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the sql.Expression interface.

func (*Coalesce) Type added in v0.2.0

func (c *Coalesce) Type() sql.Type

Type implements the sql.Expression interface. The return type of Type() is the aggregated type of the argument types.

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) Eval

func (f *Concat) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Concat) IsNullable

func (f *Concat) IsNullable() bool

IsNullable implements the Expression interface.

func (*Concat) Resolved

func (f *Concat) Resolved() bool

Resolved implements the Expression interface.

func (*Concat) String

func (f *Concat) String() string

func (*Concat) TransformUp

func (f *Concat) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Concat) Type

func (f *Concat) Type() sql.Type

Type implements the Expression interface.

type ConcatWithSeparator added in v0.2.0

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

ConcatWithSeparator joins several strings together. The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL.

func (*ConcatWithSeparator) Children added in v0.2.0

func (f *ConcatWithSeparator) Children() []sql.Expression

Children implements the Expression interface.

func (*ConcatWithSeparator) Eval added in v0.2.0

func (f *ConcatWithSeparator) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*ConcatWithSeparator) IsNullable added in v0.2.0

func (f *ConcatWithSeparator) IsNullable() bool

IsNullable implements the Expression interface.

func (*ConcatWithSeparator) Resolved added in v0.2.0

func (f *ConcatWithSeparator) Resolved() bool

Resolved implements the Expression interface.

func (*ConcatWithSeparator) String added in v0.2.0

func (f *ConcatWithSeparator) String() string

func (*ConcatWithSeparator) TransformUp added in v0.2.0

TransformUp implements the Expression interface.

func (*ConcatWithSeparator) Type added in v0.2.0

func (f *ConcatWithSeparator) Type() sql.Type

Type implements the Expression interface.

type ConnectionID added in v0.2.0

type ConnectionID struct{}

ConnectionID returns the current connection id.

func (ConnectionID) Children added in v0.2.0

func (ConnectionID) Children() []sql.Expression

Children implements the sql.Expression interface.

func (ConnectionID) Eval added in v0.2.0

func (ConnectionID) Eval(ctx *sql.Context, _ sql.Row) (interface{}, error)

Eval implements the sql.Expression interface.

func (ConnectionID) IsNullable added in v0.2.0

func (ConnectionID) IsNullable() bool

IsNullable implements the sql.Expression interface.

func (ConnectionID) Resolved added in v0.2.0

func (ConnectionID) Resolved() bool

Resolved implements the sql.Expression interface.

func (ConnectionID) String added in v0.2.0

func (ConnectionID) String() string

String implements the fmt.Stringer interface.

func (ConnectionID) TransformUp added in v0.2.0

TransformUp implements the sql.Expression interface.

func (ConnectionID) Type added in v0.2.0

func (ConnectionID) Type() sql.Type

Type implements the sql.Expression interface.

type Database added in v0.2.0

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

Database stands for DATABASE() function

func (*Database) Children added in v0.2.0

func (db *Database) Children() []sql.Expression

Children implements the sql.Expression interface.

func (*Database) Eval added in v0.2.0

func (db *Database) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the sql.Expression interface.

func (*Database) IsNullable added in v0.2.0

func (db *Database) IsNullable() bool

IsNullable implements the sql.Expression interface. The function returns always true

func (*Database) Resolved added in v0.2.0

func (db *Database) Resolved() bool

Resolved implements the sql.Expression interface.

func (*Database) String added in v0.2.0

func (*Database) String() string

func (*Database) TransformUp added in v0.2.0

func (db *Database) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the sql.Expression interface.

func (*Database) Type added in v0.2.0

func (db *Database) Type() sql.Type

Type implements the sql.Expression (sql.Text)

type Day

type Day struct {
	expression.UnaryExpression
}

Day is a function that returns the day of a date.

func (*Day) Eval

func (d *Day) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Day) String

func (d *Day) String() string

func (*Day) TransformUp

func (d *Day) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Day) Type

func (d *Day) Type() sql.Type

Type implements the Expression interface.

type DayOfWeek added in v0.2.0

type DayOfWeek struct {
	expression.UnaryExpression
}

DayOfWeek is a function that returns the day of the week from a date where 1 = Sunday, ..., 7 = Saturday.

func (*DayOfWeek) Eval added in v0.2.0

func (d *DayOfWeek) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*DayOfWeek) String added in v0.2.0

func (d *DayOfWeek) String() string

func (*DayOfWeek) TransformUp added in v0.2.0

func (d *DayOfWeek) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*DayOfWeek) Type added in v0.2.0

func (d *DayOfWeek) Type() sql.Type

Type 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) Eval

func (d *DayOfYear) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*DayOfYear) String

func (d *DayOfYear) String() string

func (*DayOfYear) TransformUp

func (d *DayOfYear) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*DayOfYear) Type

func (d *DayOfYear) Type() sql.Type

Type implements the Expression interface.

type Floor added in v0.2.0

type Floor struct {
	expression.UnaryExpression
}

Floor returns the biggest integer value not less than X.

func (*Floor) Eval added in v0.2.0

func (f *Floor) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Floor) String added in v0.2.0

func (f *Floor) String() string

func (*Floor) TransformUp added in v0.2.0

func (f *Floor) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Floor) Type added in v0.2.0

func (f *Floor) Type() sql.Type

Type implements the Expression interface.

type Hour

type Hour struct {
	expression.UnaryExpression
}

Hour is a function that returns the hour of a date.

func (*Hour) Eval

func (h *Hour) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Hour) String

func (h *Hour) String() string

func (*Hour) TransformUp

func (h *Hour) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Hour) Type

func (h *Hour) Type() sql.Type

Type implements the Expression interface.

type IfNull added in v0.3.0

type IfNull struct {
	expression.BinaryExpression
}

IfNull function returns the specified value IF the expression is NULL, otherwise return the expression.

func (*IfNull) Eval added in v0.3.0

func (f *IfNull) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*IfNull) IsNullable added in v0.3.0

func (f *IfNull) IsNullable() bool

IsNullable implements the Expression interface.

func (*IfNull) String added in v0.3.0

func (f *IfNull) String() string

func (*IfNull) TransformUp added in v0.3.0

func (f *IfNull) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*IfNull) Type added in v0.3.0

func (f *IfNull) Type() sql.Type

Type 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) Eval

func (ib *IsBinary) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*IsBinary) String

func (ib *IsBinary) String() string

func (*IsBinary) TransformUp

func (ib *IsBinary) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*IsBinary) Type

func (ib *IsBinary) Type() sql.Type

Type implements the Expression interface.

type JSONExtract added in v0.2.0

type JSONExtract struct {
	JSON  sql.Expression
	Paths []sql.Expression
}

JSONExtract extracts data from a json document using json paths.

func (*JSONExtract) Children added in v0.2.0

func (j *JSONExtract) Children() []sql.Expression

Children implements the sql.Expression interface.

func (*JSONExtract) Eval added in v0.2.0

func (j *JSONExtract) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the sql.Expression interface.

func (*JSONExtract) IsNullable added in v0.2.0

func (j *JSONExtract) IsNullable() bool

IsNullable implements the sql.Expression interface.

func (*JSONExtract) Resolved added in v0.2.0

func (j *JSONExtract) Resolved() bool

Resolved implements the sql.Expression interface.

func (*JSONExtract) String added in v0.2.0

func (j *JSONExtract) String() string

func (*JSONExtract) TransformUp added in v0.2.0

func (j *JSONExtract) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the sql.Expression interface.

func (*JSONExtract) Type added in v0.2.0

func (j *JSONExtract) Type() sql.Type

Type implements the sql.Expression interface.

type Log added in v0.2.0

type Log struct {
	expression.BinaryExpression
}

Log is a function that returns the natural logarithm of a value.

func (*Log) Children added in v0.2.0

func (l *Log) Children() []sql.Expression

Children implements the Expression interface.

func (*Log) Eval added in v0.2.0

func (l *Log) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Log) IsNullable added in v0.2.0

func (l *Log) IsNullable() bool

IsNullable implements the Expression interface.

func (*Log) String added in v0.2.0

func (l *Log) String() string

func (*Log) TransformUp added in v0.2.0

func (l *Log) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Log) Type added in v0.2.0

func (l *Log) Type() sql.Type

Type returns the resultant type of the function.

type LogBase added in v0.2.0

type LogBase struct {
	expression.UnaryExpression
	// contains filtered or unexported fields
}

LogBase is a function that returns the logarithm of a value with a specific base.

func (*LogBase) Eval added in v0.2.0

func (l *LogBase) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*LogBase) IsNullable added in v0.2.0

func (l *LogBase) IsNullable() bool

IsNullable implements the sql.Expression interface.

func (*LogBase) String added in v0.2.0

func (l *LogBase) String() string

func (*LogBase) TransformUp added in v0.2.0

func (l *LogBase) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*LogBase) Type added in v0.2.0

func (l *LogBase) Type() sql.Type

Type returns the resultant type of the function.

type Lower added in v0.2.0

type Lower struct {
	expression.UnaryExpression
}

Lower is a function that returns the lowercase of the text provided.

func (*Lower) Eval added in v0.2.0

func (l *Lower) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Lower) String added in v0.2.0

func (l *Lower) String() string

func (*Lower) TransformUp added in v0.2.0

func (l *Lower) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Lower) Type added in v0.2.0

func (l *Lower) Type() sql.Type

Type implements the Expression interface.

type Minute

type Minute struct {
	expression.UnaryExpression
}

Minute is a function that returns the minute of a date.

func (*Minute) Eval

func (m *Minute) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Minute) String

func (m *Minute) String() string

func (*Minute) TransformUp

func (m *Minute) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Minute) Type

func (m *Minute) Type() sql.Type

Type implements the Expression interface.

type Month

type Month struct {
	expression.UnaryExpression
}

Month is a function that returns the month of a date.

func (*Month) Eval

func (m *Month) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Month) String

func (m *Month) String() string

func (*Month) TransformUp

func (m *Month) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Month) Type

func (m *Month) Type() sql.Type

Type implements the Expression interface.

type Now added in v0.3.0

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

Now is a function that returns the current time.

func (*Now) Children added in v0.3.0

func (*Now) Children() []sql.Expression

Children implements the sql.Expression interface.

func (*Now) Eval added in v0.3.0

func (n *Now) Eval(*sql.Context, sql.Row) (interface{}, error)

Eval implements the sql.Expression interface.

func (*Now) IsNullable added in v0.3.0

func (*Now) IsNullable() bool

IsNullable implements the sql.Expression interface.

func (*Now) Resolved added in v0.3.0

func (*Now) Resolved() bool

Resolved implements the sql.Expression interface.

func (*Now) String added in v0.3.0

func (*Now) String() string

func (*Now) TransformUp added in v0.3.0

func (n *Now) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the sql.Expression interface.

func (*Now) Type added in v0.3.0

func (*Now) Type() sql.Type

Type implements the sql.Expression interface.

type NullIf added in v0.3.0

type NullIf struct {
	expression.BinaryExpression
}

NullIf function compares two expressions and returns NULL if they are equal. Otherwise, the first expression is returned.

func (*NullIf) Eval added in v0.3.0

func (f *NullIf) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*NullIf) IsNullable added in v0.3.0

func (f *NullIf) IsNullable() bool

IsNullable implements the Expression interface.

func (*NullIf) String added in v0.3.0

func (f *NullIf) String() string

func (*NullIf) TransformUp added in v0.3.0

func (f *NullIf) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*NullIf) Type added in v0.3.0

func (f *NullIf) Type() sql.Type

Type implements the Expression interface.

type Pad added in v0.2.0

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

Pad is a function that pads a string with another string.

func (*Pad) Children added in v0.2.0

func (p *Pad) Children() []sql.Expression

Children implements the Expression interface.

func (*Pad) Eval added in v0.2.0

func (p *Pad) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Pad) IsNullable added in v0.2.0

func (p *Pad) IsNullable() bool

IsNullable implements the Expression interface.

func (*Pad) Resolved added in v0.2.0

func (p *Pad) Resolved() bool

Resolved implements the Expression interface.

func (*Pad) String added in v0.2.0

func (p *Pad) String() string

func (*Pad) TransformUp added in v0.2.0

func (p *Pad) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Pad) Type added in v0.2.0

func (p *Pad) Type() sql.Type

Type implements the Expression interface.

type Power added in v0.2.0

type Power struct {
	expression.BinaryExpression
}

Power is a function that returns value of X raised to the power of Y.

func (*Power) Eval added in v0.2.0

func (p *Power) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Power) IsNullable added in v0.2.0

func (p *Power) IsNullable() bool

IsNullable implements the Expression interface.

func (*Power) String added in v0.2.0

func (p *Power) String() string

func (*Power) TransformUp added in v0.2.0

func (p *Power) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Power) Type added in v0.2.0

func (p *Power) Type() sql.Type

Type implements the Expression interface.

type Repeat added in v0.2.0

type Repeat struct {
	expression.BinaryExpression
}

Repeat is a function that returns the string repeated n times.

func (*Repeat) Eval added in v0.2.0

func (r *Repeat) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Repeat) String added in v0.2.0

func (r *Repeat) String() string

func (*Repeat) TransformUp added in v0.2.0

func (r *Repeat) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Repeat) Type added in v0.2.0

func (r *Repeat) Type() sql.Type

Type implements the Expression interface.

type Replace added in v0.2.0

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

Replace is a function that returns a string with all occurrences of fromStr replaced by the string toStr

func (*Replace) Children added in v0.2.0

func (r *Replace) Children() []sql.Expression

Children implements the Expression interface.

func (*Replace) Eval added in v0.2.0

func (r *Replace) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Replace) IsNullable added in v0.2.0

func (r *Replace) IsNullable() bool

IsNullable implements the Expression interface.

func (*Replace) Resolved added in v0.2.0

func (r *Replace) Resolved() bool

Resolved implements the Expression interface.

func (*Replace) String added in v0.2.0

func (r *Replace) String() string

func (*Replace) TransformUp added in v0.2.0

func (r *Replace) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Replace) Type added in v0.2.0

func (r *Replace) Type() sql.Type

Type implements the Expression interface.

type Reverse added in v0.2.0

type Reverse struct {
	expression.UnaryExpression
}

Reverse is a function that returns the reverse of the text provided.

func (*Reverse) Eval added in v0.2.0

func (r *Reverse) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Reverse) String added in v0.2.0

func (r *Reverse) String() string

func (*Reverse) TransformUp added in v0.2.0

func (r *Reverse) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Reverse) Type added in v0.2.0

func (r *Reverse) Type() sql.Type

Type implements the Expression interface.

type Round added in v0.2.0

type Round struct {
	expression.BinaryExpression
}

Round returns the number (x) with (d) requested decimal places. If d is negative, the number is returned with the (abs(d)) least significant digits of it's integer part set to 0. If d is not specified or nil/null it defaults to 0.

func (*Round) Children added in v0.2.0

func (r *Round) Children() []sql.Expression

Children implements the Expression interface.

func (*Round) Eval added in v0.2.0

func (r *Round) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Round) IsNullable added in v0.2.0

func (r *Round) IsNullable() bool

IsNullable implements the Expression interface.

func (*Round) Resolved added in v0.2.0

func (r *Round) Resolved() bool

Resolved implements the Expression interface.

func (*Round) String added in v0.2.0

func (r *Round) String() string

func (*Round) TransformUp added in v0.2.0

func (r *Round) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Round) Type added in v0.2.0

func (r *Round) Type() sql.Type

Type implements the Expression interface.

type Second

type Second struct {
	expression.UnaryExpression
}

Second is a function that returns the second of a date.

func (*Second) Eval

func (s *Second) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Second) String

func (s *Second) String() string

func (*Second) TransformUp

func (s *Second) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Second) Type

func (s *Second) Type() sql.Type

Type implements the Expression interface.

type Soundex added in v0.2.0

type Soundex struct {
	expression.UnaryExpression
}

Soundex is a function that returns the soundex of a string. Two strings that sound almost the same should have identical soundex strings. A standard soundex string is four characters long, but the SOUNDEX() function returns an arbitrarily long string.

func (*Soundex) Eval added in v0.2.0

func (s *Soundex) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Soundex) String added in v0.2.0

func (s *Soundex) String() string

func (*Soundex) TransformUp added in v0.2.0

func (s *Soundex) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Soundex) Type added in v0.2.0

func (s *Soundex) Type() sql.Type

Type 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) Eval

func (f *Split) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Split) IsNullable

func (f *Split) IsNullable() bool

IsNullable implements the Expression interface.

func (*Split) String

func (f *Split) String() string

func (*Split) TransformUp

func (f *Split) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Split) Type

func (*Split) Type() sql.Type

Type implements the Expression interface.

type Sqrt added in v0.2.0

type Sqrt struct {
	expression.UnaryExpression
}

Sqrt is a function that returns the square value of the number provided.

func (*Sqrt) Eval added in v0.2.0

func (s *Sqrt) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Sqrt) IsNullable added in v0.2.0

func (s *Sqrt) IsNullable() bool

IsNullable implements the Expression interface.

func (*Sqrt) String added in v0.2.0

func (s *Sqrt) String() string

func (*Sqrt) TransformUp added in v0.2.0

func (s *Sqrt) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Sqrt) Type added in v0.2.0

func (s *Sqrt) Type() sql.Type

Type 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) Eval

func (s *Substring) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Substring) IsNullable

func (s *Substring) IsNullable() bool

IsNullable implements the Expression interface.

func (*Substring) Resolved

func (s *Substring) Resolved() bool

Resolved implements the Expression interface.

func (*Substring) String

func (s *Substring) String() string

func (*Substring) TransformUp

func (s *Substring) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Substring) Type

func (*Substring) Type() sql.Type

Type implements the Expression interface.

type Trim added in v0.2.0

type Trim struct {
	expression.UnaryExpression
	// contains filtered or unexported fields
}

Trim is a function that returns the string with prefix or suffix spaces removed based on the trimType

func (*Trim) Eval added in v0.2.0

func (t *Trim) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Trim) IsNullable added in v0.2.0

func (t *Trim) IsNullable() bool

IsNullable implements the Expression interface.

func (*Trim) String added in v0.2.0

func (t *Trim) String() string

func (*Trim) TransformUp added in v0.2.0

func (t *Trim) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Trim) Type added in v0.2.0

func (t *Trim) Type() sql.Type

Type implements the Expression interface.

type Upper added in v0.2.0

type Upper struct {
	expression.UnaryExpression
}

Upper is a function that returns the UPPERCASE of the text provided.

func (*Upper) Eval added in v0.2.0

func (u *Upper) Eval(
	ctx *sql.Context,
	row sql.Row,
) (interface{}, error)

Eval implements the Expression interface.

func (*Upper) String added in v0.2.0

func (u *Upper) String() string

func (*Upper) TransformUp added in v0.2.0

func (u *Upper) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Upper) Type added in v0.2.0

func (u *Upper) Type() sql.Type

Type 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) Eval

func (f Version) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (Version) IsNullable

func (f Version) IsNullable() bool

IsNullable implements the Expression interface.

func (Version) Resolved

func (f Version) Resolved() bool

Resolved implements the Expression interface.

func (Version) String

func (f Version) String() string

func (Version) TransformUp

func (f Version) TransformUp(fn sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (Version) Type

func (f Version) Type() sql.Type

Type implements the Expression interface.

type Weekday added in v0.2.0

type Weekday struct {
	expression.UnaryExpression
}

Weekday is a function that returns the weekday of a date where 0 = Monday, ..., 6 = Sunday.

func (*Weekday) Eval added in v0.2.0

func (d *Weekday) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Weekday) String added in v0.2.0

func (d *Weekday) String() string

func (*Weekday) TransformUp added in v0.2.0

func (d *Weekday) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Weekday) Type added in v0.2.0

func (d *Weekday) Type() sql.Type

Type implements the Expression interface.

type Year

type Year struct {
	expression.UnaryExpression
}

Year is a function that returns the year of a date.

func (*Year) Eval

func (y *Year) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Year) String

func (y *Year) String() string

func (*Year) TransformUp

func (y *Year) TransformUp(f sql.TransformExprFunc) (sql.Expression, error)

TransformUp implements the Expression interface.

func (*Year) Type

func (y *Year) Type() sql.Type

Type implements the Expression interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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