sql

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BigInteger = bigIntegerType{}
View Source
var ErrInvalidType = errors.New("invalid type")
View Source
var Integer = integerType{}
View Source
var Null = nullType{}
View Source
var String = stringType{}
View Source
var TimestampWithTimezone = timestampWithTimeZoneType{}

TimestampWithTimezone is a timestamp with timezone.

Functions

This section is empty.

Types

type Aggregation added in v0.3.0

type Aggregation interface {
	Update(Row) (Row, error)
	Merge(Row)
	Eval() interface{}
}

type AggregationExpression added in v0.3.0

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 []Database
	Functions map[string]*FunctionEntry
}

func NewCatalog added in v0.3.0

func NewCatalog() *Catalog

func (Catalog) Database

func (c Catalog) Database(name string) (Database, error)

func (Catalog) Function added in v0.3.0

func (c Catalog) Function(name string) (*FunctionEntry, error)

func (Catalog) RegisterFunction added in v0.3.0

func (c Catalog) RegisterFunction(name string, f interface{}) error

func (Catalog) Table

func (c Catalog) Table(dbName string, tableName string) (Table, error)

type Database

type Database interface {
	Nameable
	Tables() map[string]Table
}

type Expression

type Expression interface {
	Resolvable
	Type() Type
	Name() string
	Eval(Row) interface{}
	TransformUp(func(Expression) Expression) Expression
}

type Field

type Field struct {
	Name string
	Type Type
}

type FunctionEntry added in v0.3.0

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

func (*FunctionEntry) Build added in v0.3.0

func (e *FunctionEntry) Build(args ...Expression) (Expression, error)

type Nameable

type Nameable interface {
	Name() string
}

type Node

type Node interface {
	Resolvable
	Transformable
	Schema() Schema
	Children() []Node
	RowIter() (RowIter, error)
}

type Resolvable

type Resolvable interface {
	Resolved() bool
}

type Row

type Row []Value

func NewRow added in v0.4.0

func NewRow(values ...interface{}) Row

func NodeToRows added in v0.2.0

func NodeToRows(n Node) ([]Row, error)

func RowIterToRows added in v0.2.0

func RowIterToRows(i RowIter) ([]Row, error)

func (Row) Copy added in v0.4.0

func (r Row) Copy() Row

type RowIter

type RowIter interface {
	Next() (Row, error)
}

type Schema

type Schema []Field

func (Schema) CheckRow added in v0.2.0

func (s Schema) CheckRow(row Row) error

type Table added in v0.1.0

type Table interface {
	Nameable
	Node
}

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
}
var Boolean Type = booleanType{}
var Float Type = floatType{}

type UnresolvedDatabase added in v0.1.0

type UnresolvedDatabase struct{}

func (*UnresolvedDatabase) Name added in v0.1.0

func (d *UnresolvedDatabase) Name() string

func (*UnresolvedDatabase) Tables added in v0.1.0

func (d *UnresolvedDatabase) Tables() map[string]Table

type Value added in v0.4.0

type Value interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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