Documentation ¶
Index ¶
- Variables
- type Aggregation
- type AggregationExpression
- type Catalog
- type Column
- type Database
- type Databases
- type Expression
- type ExpressionBuilder
- type FunctionRegistry
- type Inserter
- type Nameable
- type Node
- type Resolvable
- type Row
- type RowIter
- type Schema
- type Table
- type Transformable
- type Type
- type UnresolvedDatabase
Constants ¶
This section is empty.
Variables ¶
var BigInteger = bigIntegerType{}
var ErrInvalidType = errors.New("invalid type")
var Integer = integerType{}
var Null = nullType{}
var String = stringType{}
var TimestampWithTimezone = timestampWithTimeZoneType{}
TimestampWithTimezone is a timestamp with timezone.
Functions ¶
This section is empty.
Types ¶
type Aggregation ¶
type AggregationExpression ¶
type AggregationExpression interface { Expression // NewBuffer creates a new aggregation buffer and returns it as a Row. NewBuffer() Row // Update updates the given buffer with the given row. Update(buffer, row Row) // Merge merges a partial buffer into a global one. Merge(buffer, partial Row) }
AggregationExpression implements an aggregation expression, where an aggregation buffer is created for each grouping (NewBuffer) and rows in the grouping are fed to the buffer (Update). Multiple buffers can be merged (Merge), making partial aggregations possible. Note that Eval must be called with the final aggregation buffer in order to get the final result.
type Catalog ¶
type Catalog struct { Databases FunctionRegistry }
Catalog holds databases, tables and functions.
type Column ¶
type Column struct { // Name is the name of the column. Name string // Type is the data type of the column. Type Type // Default contains the default value of the column or nil if it is NULL. Default interface{} // Nullable is true if the column can contain NULL values, or false // otherwise. Nullable bool }
Column is the definition of a table column. As SQL:2016 puts it:
A column is a named component of a table. It has a data type, a default, and a nullability characteristic.
type Databases ¶
type Databases []Database
Databases is a collection of Database.
type Expression ¶
type Expression interface { Resolvable Type() Type Name() string IsNullable() bool Eval(Row) interface{} TransformUp(func(Expression) Expression) Expression }
type ExpressionBuilder ¶
type ExpressionBuilder interface {
Build(...Expression) (Expression, error)
}
ExpressionBuilder can build an Expression out of a given list of expressions.
type FunctionRegistry ¶
type FunctionRegistry map[string]ExpressionBuilder
FunctionRegistry is used to register functions. It is used both for builtin and User-Defined Functions.
func NewFunctionRegistry ¶
func NewFunctionRegistry() FunctionRegistry
NewFunctionRegistry creates a new FunctionRegistry.
func (FunctionRegistry) Function ¶
func (r FunctionRegistry) Function(name string) (ExpressionBuilder, error)
Function returns an ExpressionBuilder for the given function name.
func (FunctionRegistry) RegisterFunction ¶
func (r FunctionRegistry) RegisterFunction(name string, f interface{}) error
RegisterFunction registers a function with the given name.
type Node ¶
type Node interface { Resolvable Transformable Schema() Schema Children() []Node RowIter() (RowIter, error) }
type Resolvable ¶
type Resolvable interface {
Resolved() bool
}
type RowIter ¶
func RowsToRowIter ¶ added in v0.7.0
RowsToRowIter creates a RowIter that iterates over the given rows.
type Transformable ¶
type Transformable interface { TransformUp(func(Node) Node) Node TransformExpressionsUp(func(Expression) Expression) Node }
type Type ¶
type Type interface { Name() string InternalType() reflect.Kind Check(interface{}) bool Convert(interface{}) (interface{}, error) Compare(interface{}, interface{}) int Native(interface{}) driver.Value Default() interface{} }
var Boolean Type = booleanType{}
var Float Type = floatType{}
type UnresolvedDatabase ¶
type UnresolvedDatabase struct{}
func (*UnresolvedDatabase) Name ¶
func (d *UnresolvedDatabase) Name() string
func (*UnresolvedDatabase) Tables ¶
func (d *UnresolvedDatabase) Tables() map[string]Table