Documentation ¶
Index ¶
- Variables
- func NewEmptyGroupConcat() sql.Expression
- func NewJSONObjectAgg(key, value sql.Expression) sql.Expression
- type Avg
- func (a *Avg) Description() string
- func (a *Avg) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (a *Avg) FunctionName() string
- func (a *Avg) IsNullable() bool
- func (a *Avg) NewBuffer() (sql.AggregationBuffer, error)
- func (a *Avg) String() string
- func (a *Avg) Type() sql.Type
- func (a *Avg) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type Count
- func (c *Count) Description() string
- func (c *Count) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *Count) FunctionName() string
- func (c *Count) IsNullable() bool
- func (c *Count) NewBuffer() (sql.AggregationBuffer, error)
- func (c *Count) Resolved() bool
- func (c *Count) String() string
- func (c *Count) Type() sql.Type
- func (c *Count) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type CountDistinct
- func (c *CountDistinct) Description() string
- func (c *CountDistinct) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (c *CountDistinct) FunctionName() string
- func (c *CountDistinct) IsNullable() bool
- func (c *CountDistinct) NewBuffer() (sql.AggregationBuffer, error)
- func (c *CountDistinct) Resolved() bool
- func (c *CountDistinct) String() string
- func (c *CountDistinct) Type() sql.Type
- func (c *CountDistinct) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type First
- func (f *First) Description() string
- func (f *First) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (f *First) FunctionName() string
- func (f *First) NewBuffer() (sql.AggregationBuffer, error)
- func (f *First) String() string
- func (f *First) Type() sql.Type
- func (f *First) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type GroupConcat
- func (g *GroupConcat) Children() []sql.Expression
- func (g *GroupConcat) Description() string
- func (g *GroupConcat) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (g *GroupConcat) FunctionName() string
- func (g *GroupConcat) IsNullable() bool
- func (g *GroupConcat) NewBuffer() (sql.AggregationBuffer, error)
- func (g *GroupConcat) Resolved() bool
- func (g *GroupConcat) String() string
- func (g *GroupConcat) Type() sql.Type
- func (g *GroupConcat) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type JSONArrayAgg
- func (j *JSONArrayAgg) Description() string
- func (j *JSONArrayAgg) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (j *JSONArrayAgg) FunctionName() string
- func (j *JSONArrayAgg) IsNullable() bool
- func (j *JSONArrayAgg) IsUnsupported() bool
- func (j *JSONArrayAgg) NewBuffer() (sql.AggregationBuffer, error)
- func (j *JSONArrayAgg) Resolved() bool
- func (j *JSONArrayAgg) String() string
- func (j *JSONArrayAgg) Type() sql.Type
- func (j *JSONArrayAgg) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type JSONObjectAgg
- func (j JSONObjectAgg) Children() []sql.Expression
- func (j JSONObjectAgg) Description() string
- func (j JSONObjectAgg) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (j JSONObjectAgg) FunctionName() string
- func (j JSONObjectAgg) IsNullable() bool
- func (j JSONObjectAgg) IsUnsupported() bool
- func (j JSONObjectAgg) NewBuffer() (sql.AggregationBuffer, error)
- func (j JSONObjectAgg) Resolved() bool
- func (j JSONObjectAgg) String() string
- func (j JSONObjectAgg) Type() sql.Type
- func (j JSONObjectAgg) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type Last
- func (l *Last) Description() string
- func (l *Last) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (l *Last) FunctionName() string
- func (l *Last) NewBuffer() (sql.AggregationBuffer, error)
- func (l *Last) String() string
- func (l *Last) Type() sql.Type
- func (l *Last) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type Max
- func (m *Max) DebugString() string
- func (m *Max) Description() string
- func (m *Max) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (m *Max) FunctionName() string
- func (m *Max) IsNullable() bool
- func (m *Max) NewBuffer() (sql.AggregationBuffer, error)
- func (m *Max) String() string
- func (m *Max) Type() sql.Type
- func (m *Max) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type Min
- func (m *Min) Description() string
- func (m *Min) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (m *Min) FunctionName() string
- func (m *Min) IsNullable() bool
- func (m *Min) NewBuffer() (sql.AggregationBuffer, error)
- func (m *Min) String() string
- func (m *Min) Type() sql.Type
- func (m *Min) WithChildren(children ...sql.Expression) (sql.Expression, error)
- type Sum
- func (m *Sum) Description() string
- func (m *Sum) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)
- func (m *Sum) FunctionName() string
- func (m *Sum) NewBuffer() (sql.AggregationBuffer, error)
- func (m *Sum) String() string
- func (m *Sum) Type() sql.Type
- func (m *Sum) WithChildren(children ...sql.Expression) (sql.Expression, error)
Constants ¶
This section is empty.
Variables ¶
var ErrEvalUnsupportedOnAggregation = errors.NewKind("Unimplemented %s.Eval(). The code should have used AggregationBuffer.Eval(ctx).")
var ErrUnsupportedJSONFunction = errors.NewKind("unsupported JSON function: %s")
ErrUnsupportedJSONFunction is returned when a unsupported JSON function is called.
Functions ¶
func NewEmptyGroupConcat ¶
func NewEmptyGroupConcat() sql.Expression
func NewJSONObjectAgg ¶
func NewJSONObjectAgg(key, value sql.Expression) sql.Expression
NewJSONObjectAgg creates a new JSONArrayAgg function.
Types ¶
type Avg ¶
type Avg struct {
expression.UnaryExpression
}
Avg node to calculate the average from numeric column
func (*Avg) Description ¶
Description implements sql.FunctionExpression
func (*Avg) FunctionName ¶
FunctionName implements sql.FunctionExpression
func (*Avg) IsNullable ¶
IsNullable implements Expression interface.
func (*Avg) NewBuffer ¶
func (a *Avg) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer implements Aggregation interface.
func (*Avg) WithChildren ¶
func (a *Avg) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.
type Count ¶
type Count struct {
expression.UnaryExpression
}
Count node to count how many rows are in the result set.
func (*Count) Description ¶
Description implements sql.FunctionExpression
func (*Count) FunctionName ¶
FunctionName implements sql.FunctionExpression
func (*Count) IsNullable ¶
IsNullable returns whether the return value can be null.
func (*Count) NewBuffer ¶
func (c *Count) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer for the aggregation.
func (*Count) WithChildren ¶
func (c *Count) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.
type CountDistinct ¶
type CountDistinct struct {
expression.UnaryExpression
}
CountDistinct node to count how many rows are in the result set.
func NewCountDistinct ¶
func NewCountDistinct(e sql.Expression) *CountDistinct
NewCountDistinct creates a new CountDistinct node.
func (*CountDistinct) Description ¶
func (c *CountDistinct) Description() string
Description implements sql.FunctionExpression
func (*CountDistinct) FunctionName ¶
func (c *CountDistinct) FunctionName() string
FunctionName implements sql.FunctionExpression
func (*CountDistinct) IsNullable ¶
func (c *CountDistinct) IsNullable() bool
IsNullable returns whether the return value can be null.
func (*CountDistinct) NewBuffer ¶
func (c *CountDistinct) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer for the aggregation.
func (*CountDistinct) Resolved ¶
func (c *CountDistinct) Resolved() bool
Resolved implements the Expression interface.
func (*CountDistinct) String ¶
func (c *CountDistinct) String() string
func (*CountDistinct) Type ¶
func (c *CountDistinct) Type() sql.Type
Type returns the type of the result.
func (*CountDistinct) WithChildren ¶
func (c *CountDistinct) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.
type First ¶
type First struct {
expression.UnaryExpression
}
First aggregation returns the first of all values in the selected column. It implements the Aggregation interface.
func (*First) Description ¶
Description implements sql.FunctionExpression
func (*First) FunctionName ¶
FunctionName implements sql.FunctionExpression
func (*First) NewBuffer ¶
func (f *First) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer to compute the result.
func (*First) WithChildren ¶
func (f *First) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the sql.Expression interface.
type GroupConcat ¶
type GroupConcat struct {
// contains filtered or unexported fields
}
func NewGroupConcat ¶
func NewGroupConcat(distinct string, orderBy sql.SortFields, separator string, selectExprs []sql.Expression, maxLen int) (*GroupConcat, error)
func (*GroupConcat) Children ¶
func (g *GroupConcat) Children() []sql.Expression
Children implements the Expression interface.
func (*GroupConcat) Description ¶
func (g *GroupConcat) Description() string
Description implements sql.FunctionExpression
func (*GroupConcat) FunctionName ¶
func (g *GroupConcat) FunctionName() string
FunctionName implements sql.FunctionExpression
func (*GroupConcat) IsNullable ¶
func (g *GroupConcat) IsNullable() bool
IsNullable implements the Expression interface.
func (*GroupConcat) NewBuffer ¶
func (g *GroupConcat) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer for the aggregation.
func (*GroupConcat) Resolved ¶
func (g *GroupConcat) Resolved() bool
Resolved implements the Expression interface.
func (*GroupConcat) String ¶
func (g *GroupConcat) String() string
func (*GroupConcat) Type ¶
func (g *GroupConcat) Type() sql.Type
Type implements the Expression interface. cc: https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat for explanations on return type.
func (*GroupConcat) WithChildren ¶
func (g *GroupConcat) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.
type JSONArrayAgg ¶
type JSONArrayAgg struct {
expression.UnaryExpression
}
JSON_ARRAYAGG(col_or_expr) [over_clause]
JSONArrayAgg Aggregates a result set as a single JSON array whose elements consist of the rows. The order of elements in this array is undefined. The function acts on a column or an expression that evaluates to a single value. Returns NULL if the result contains no rows, or in the event of an error.
https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_json-arrayagg
see also: https://dev.mysql.com/doc/refman/8.0/en/json.html#json-normalization
func NewJSONArrayAgg ¶
func NewJSONArrayAgg(arg sql.Expression) *JSONArrayAgg
NewJSONArrayAgg creates a new JSONArrayAgg function.
func (*JSONArrayAgg) Description ¶
func (j *JSONArrayAgg) Description() string
Description implements sql.FunctionExpression
func (*JSONArrayAgg) FunctionName ¶
func (j *JSONArrayAgg) FunctionName() string
FunctionName implements sql.FunctionExpression
func (*JSONArrayAgg) IsNullable ¶
func (j *JSONArrayAgg) IsNullable() bool
IsNullable returns whether the return value can be null.
func (*JSONArrayAgg) IsUnsupported ¶
func (j *JSONArrayAgg) IsUnsupported() bool
IsUnsupported implements sql.FunctionExpression
func (*JSONArrayAgg) NewBuffer ¶
func (j *JSONArrayAgg) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer for the aggregation.
func (*JSONArrayAgg) Resolved ¶
func (j *JSONArrayAgg) Resolved() bool
Resolved implements the Expression interface.
func (*JSONArrayAgg) String ¶
func (j *JSONArrayAgg) String() string
func (*JSONArrayAgg) Type ¶
func (j *JSONArrayAgg) Type() sql.Type
Type returns the type of the result.
func (*JSONArrayAgg) WithChildren ¶
func (j *JSONArrayAgg) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.
type JSONObjectAgg ¶
type JSONObjectAgg struct {
// contains filtered or unexported fields
}
JSON_OBJECTAGG(key, value) [over_clause]
JSONObjectAgg Takes two column names or expressions as arguments, the first of these being used as a key and the second as a value, and returns a JSON object containing key-value pairs. Returns NULL if the result contains no rows, or in the event of an error. An error occurs if any key name is NULL or the number of arguments is not equal to 2.
https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_json-objectagg
see also: https://dev.mysql.com/doc/refman/8.0/en/json.html#json-normalization
func (JSONObjectAgg) Children ¶
func (j JSONObjectAgg) Children() []sql.Expression
Children implements the Expression interface.
func (JSONObjectAgg) Description ¶
func (j JSONObjectAgg) Description() string
Description implements sql.FunctionExpression
func (JSONObjectAgg) FunctionName ¶
func (j JSONObjectAgg) FunctionName() string
FunctionName implements sql.FunctionExpression
func (JSONObjectAgg) IsNullable ¶
func (j JSONObjectAgg) IsNullable() bool
IsNullable implements the Expression interface.
func (JSONObjectAgg) IsUnsupported ¶
func (j JSONObjectAgg) IsUnsupported() bool
IsUnsupported implements sql.UnsupportedFunctionStub
func (JSONObjectAgg) NewBuffer ¶
func (j JSONObjectAgg) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer implements the Aggregation interface.
func (JSONObjectAgg) Resolved ¶
func (j JSONObjectAgg) Resolved() bool
Resolved implements the Expression interface.
func (JSONObjectAgg) String ¶
func (j JSONObjectAgg) String() string
func (JSONObjectAgg) Type ¶
func (j JSONObjectAgg) Type() sql.Type
Type implements the Expression interface.
func (JSONObjectAgg) WithChildren ¶
func (j JSONObjectAgg) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.
type Last ¶
type Last struct {
expression.UnaryExpression
}
Last aggregation returns the last of all values in the selected column. It implements the Aggregation interface.
func (*Last) Description ¶
Description implements sql.FunctionExpression
func (*Last) FunctionName ¶
FunctionName implements sql.FunctionExpression
func (*Last) NewBuffer ¶
func (l *Last) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer to compute the result.
func (*Last) WithChildren ¶
func (l *Last) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the sql.Expression interface.
type Max ¶
type Max struct {
expression.UnaryExpression
}
Max aggregation returns the greatest value of the selected column. It implements the Aggregation interface
func (*Max) DebugString ¶
func (*Max) Description ¶
Description implements sql.FunctionExpression
func (*Max) FunctionName ¶
FunctionName implements sql.FunctionExpression
func (*Max) IsNullable ¶
IsNullable returns whether the return value can be null.
func (*Max) NewBuffer ¶
func (m *Max) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer to compute the result.
func (*Max) WithChildren ¶
func (m *Max) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.
type Min ¶
type Min struct {
expression.UnaryExpression
}
Min aggregation returns the smallest value of the selected column. It implements the Aggregation interface
func (*Min) Description ¶
Description implements sql.FunctionExpression
func (*Min) FunctionName ¶
FunctionName implements sql.FunctionExpression
func (*Min) IsNullable ¶
IsNullable returns whether the return value can be null.
func (*Min) NewBuffer ¶
func (m *Min) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer to compute the result.
func (*Min) WithChildren ¶
func (m *Min) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.
type Sum ¶
type Sum struct {
expression.UnaryExpression
}
Sum aggregation returns the sum of all values in the selected column. It implements the Aggregation interface.
func (*Sum) Description ¶
Description implements sql.FunctionExpression
func (*Sum) FunctionName ¶
FunctionName implements sql.FunctionExpression
func (*Sum) NewBuffer ¶
func (m *Sum) NewBuffer() (sql.AggregationBuffer, error)
NewBuffer creates a new buffer to compute the result.
func (*Sum) WithChildren ¶
func (m *Sum) WithChildren(children ...sql.Expression) (sql.Expression, error)
WithChildren implements the Expression interface.