Documentation ¶
Index ¶
- type Aggregate
- type AliasedExpression
- func (alExpr *AliasedExpression) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)
- func (alExpr *AliasedExpression) MaterializeNamed(ctx context.Context, matCtx *MaterializationContext) (execution.NamedExpression, error)
- func (alExpr *AliasedExpression) Transform(ctx context.Context, transformers *Transformers) Expression
- func (alExpr *AliasedExpression) TransformNamed(ctx context.Context, transformers *Transformers) NamedExpression
- type And
- type Constant
- type DataSourceBuilder
- type DataSourceBuilderFactory
- type DataSourceRepository
- type Distinct
- type Expression
- type Factory
- type FieldType
- type Filter
- type Formula
- type FunctionExpression
- type GroupBy
- type InnerJoin
- type LeftJoin
- type Limit
- type LogicExpression
- type Map
- type MaterializationContext
- type NamedExpression
- type Node
- type NodeExpression
- type Not
- type Offset
- type Or
- type OrderBy
- type OrderDirection
- type Predicate
- type Relation
- type Requalifier
- type Transformers
- type Tuple
- type UnionAll
- type Variable
- func (v *Variable) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)
- func (v *Variable) MaterializeNamed(ctx context.Context, matCtx *MaterializationContext) (execution.NamedExpression, error)
- func (v *Variable) Transform(ctx context.Context, transformers *Transformers) Expression
- func (v *Variable) TransformNamed(ctx context.Context, transformers *Transformers) NamedExpression
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliasedExpression ¶
type AliasedExpression struct { Name octosql.VariableName Expr Expression }
AliasedExpression describes an expression which is explicitly named.
func NewAliasedExpression ¶
func NewAliasedExpression(name octosql.VariableName, expr Expression) *AliasedExpression
func (*AliasedExpression) Materialize ¶
func (alExpr *AliasedExpression) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)
func (*AliasedExpression) MaterializeNamed ¶
func (alExpr *AliasedExpression) MaterializeNamed(ctx context.Context, matCtx *MaterializationContext) (execution.NamedExpression, error)
func (*AliasedExpression) Transform ¶
func (alExpr *AliasedExpression) Transform(ctx context.Context, transformers *Transformers) Expression
func (*AliasedExpression) TransformNamed ¶
func (alExpr *AliasedExpression) TransformNamed(ctx context.Context, transformers *Transformers) NamedExpression
type And ¶
type And struct {
Left, Right Formula
}
func (*And) ExtractPredicates ¶
func (*And) Materialize ¶
func (*And) SplitByAnd ¶
type Constant ¶
type Constant struct {
Value bool
}
func NewConstant ¶
func (*Constant) ExtractPredicates ¶
func (*Constant) Materialize ¶
func (*Constant) SplitByAnd ¶
type DataSourceBuilder ¶
type DataSourceBuilder struct { Materializer func(ctx context.Context, matCtx *MaterializationContext, dbConfig map[string]interface{}, filter Formula, alias string) (execution.Node, error) PrimaryKeys []octosql.VariableName AvailableFilters map[FieldType]map[Relation]struct{} Filter Formula Name string Alias string }
DataSourceBuilder is used to build a data source instance with an alias. It may be given filters, which are later executed at the database level.
func (*DataSourceBuilder) Materialize ¶
func (dsb *DataSourceBuilder) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)
func (*DataSourceBuilder) Transform ¶
func (dsb *DataSourceBuilder) Transform(ctx context.Context, transformers *Transformers) Node
type DataSourceBuilderFactory ¶
type DataSourceBuilderFactory func(name, alias string) *DataSourceBuilder
DataSourceBuilderFactory is a function used to create a new aliased data source builder.
func NewDataSourceBuilderFactory ¶
func NewDataSourceBuilderFactory(materializer func(ctx context.Context, matCtx *MaterializationContext, dbConfig map[string]interface{}, filter Formula, alias string) (execution.Node, error), primaryKeys []octosql.VariableName, availableFilters map[FieldType]map[Relation]struct{}) DataSourceBuilderFactory
type DataSourceRepository ¶
type DataSourceRepository struct {
// contains filtered or unexported fields
}
DataSourceRepository is used to register factories for builders for any data source. It can also later create a builder for any of those data source.
func CreateDataSourceRepositoryFromConfig ¶ added in v0.1.1
func CreateDataSourceRepositoryFromConfig(factories map[string]Factory, config *config.Config) (*DataSourceRepository, error)
CreateDataSourceRepositoryFromConfig creates a DataSourceRepository from a config, using the given configuration reading data source factories. The map should be given as databaseType -> Factory.
func NewDataSourceRepository ¶
func NewDataSourceRepository() *DataSourceRepository
func (*DataSourceRepository) Get ¶
func (repo *DataSourceRepository) Get(dataSourceName, alias string) (*DataSourceBuilder, error)
Get gets a new builder for a given data source.
func (*DataSourceRepository) Register ¶
func (repo *DataSourceRepository) Register(dataSourceName string, factory DataSourceBuilderFactory) error
Register registers a builder factory for the given data source ColumnName.
type Distinct ¶
type Distinct struct {
Child Node
}
func NewDistinct ¶
func (*Distinct) Materialize ¶
type Expression ¶
type Expression interface { // Transform returns a new Expression after recursively calling Transform Transform(ctx context.Context, transformers *Transformers) Expression Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error) }
Expressions describes a single value source.
type Factory ¶ added in v0.1.1
type Factory func(dbConfig map[string]interface{}) (DataSourceBuilderFactory, error)
type FieldType ¶
type FieldType string
FieldType describes if a key is a primary or secondary attribute.
type Filter ¶
func (*Filter) Materialize ¶
type Formula ¶
type Formula interface { // Transform returns a new Formula after recursively calling Transform Transform(ctx context.Context, transformers *Transformers) Formula SplitByAnd() []Formula ExtractPredicates() []*Predicate Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Formula, error) }
Formula describes any source of a logical value.
type FunctionExpression ¶
type FunctionExpression struct {
// contains filtered or unexported fields
}
func NewFunctionExpression ¶
func NewFunctionExpression(name string, args []Expression) *FunctionExpression
func (*FunctionExpression) Materialize ¶
func (fe *FunctionExpression) Materialize(ctx context2.Context, matCtx *MaterializationContext) (execution.Expression, error)
func (*FunctionExpression) Transform ¶
func (fe *FunctionExpression) Transform(ctx context.Context, transformers *Transformers) Expression
type GroupBy ¶
type GroupBy struct { Source Node Key []Expression Fields []octosql.VariableName Aggregates []Aggregate As []octosql.VariableName }
func NewGroupBy ¶
func NewGroupBy(source Node, key []Expression, fields []octosql.VariableName, aggregates []Aggregate, as []octosql.VariableName) *GroupBy
func (*GroupBy) Materialize ¶
type Limit ¶
type Limit struct {
// contains filtered or unexported fields
}
func NewLimit ¶
func NewLimit(data Node, expr Expression) *Limit
func (*Limit) Materialize ¶
type LogicExpression ¶
type LogicExpression struct {
Formula Formula
}
LogicExpressions describes a boolean expression which get's it's value from the logic formula underneath.
func NewLogicExpression ¶
func NewLogicExpression(formula Formula) *LogicExpression
func (*LogicExpression) Materialize ¶
func (le *LogicExpression) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)
func (*LogicExpression) Transform ¶
func (le *LogicExpression) Transform(ctx context.Context, transformers *Transformers) Expression
type Map ¶
type Map struct { Expressions []NamedExpression Source Node Keep bool }
func (*Map) Materialize ¶
type MaterializationContext ¶ added in v0.1.1
MaterializationContext is a structure containing the configuration for the materialization.
func NewMaterializationContext ¶ added in v0.1.1
func NewMaterializationContext(config *config.Config) *MaterializationContext
type NamedExpression ¶
type NamedExpression interface { Expression // TransformNamed returns a new NamedExpression after recursively calling Transform TransformNamed(ctx context.Context, transformers *Transformers) NamedExpression MaterializeNamed(ctx context.Context, matCtx *MaterializationContext) (execution.NamedExpression, error) }
NamedExpressions describes a single named value source.
type Node ¶
type Node interface { // Transform returns a new Node after recursively calling Transform Transform(ctx context.Context, transformers *Transformers) Node Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error) }
Node describes a single record stream source.
type NodeExpression ¶
type NodeExpression struct {
Node Node
}
NodeExpressions describes an expression which gets it's value from a node underneath.
func NewNodeExpression ¶
func NewNodeExpression(node Node) *NodeExpression
func (*NodeExpression) Materialize ¶
func (ne *NodeExpression) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)
func (*NodeExpression) Transform ¶
func (ne *NodeExpression) Transform(ctx context.Context, transformers *Transformers) Expression
type Not ¶
type Not struct {
Child Formula
}
func (*Not) ExtractPredicates ¶
func (*Not) Materialize ¶
func (*Not) SplitByAnd ¶
type Offset ¶
type Offset struct {
// contains filtered or unexported fields
}
func NewOffset ¶
func NewOffset(data Node, expr Expression) *Offset
func (*Offset) Materialize ¶
type Or ¶
type Or struct {
Left, Right Formula
}
func (*Or) ExtractPredicates ¶
func (*Or) Materialize ¶
func (*Or) SplitByAnd ¶
type OrderBy ¶
type OrderBy struct { Expressions []Expression Directions []OrderDirection Source Node }
func NewOrderBy ¶
func NewOrderBy(expressions []Expression, directions []OrderDirection, source Node) *OrderBy
func (*OrderBy) Materialize ¶
type OrderDirection ¶
type OrderDirection string
const ( Ascending OrderDirection = "asc" Descending OrderDirection = "desc" )
type Predicate ¶
type Predicate struct { Left Expression Relation Relation Right Expression }
func NewPredicate ¶
func NewPredicate(left Expression, relation Relation, right Expression) *Predicate
func (*Predicate) ExtractPredicates ¶
func (*Predicate) Materialize ¶
func (*Predicate) SplitByAnd ¶
type Relation ¶
type Relation string
Relation describes a comparison operator.
func NewRelation ¶
func (Relation) Materialize ¶
type Requalifier ¶
func NewRequalifier ¶
func NewRequalifier(qualifier string, child Node) *Requalifier
func (*Requalifier) Materialize ¶
func (node *Requalifier) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)
func (*Requalifier) Transform ¶
func (node *Requalifier) Transform(ctx context.Context, transformers *Transformers) Node
type Transformers ¶
type Transformers struct { NodeT func(Node) Node ExprT func(Expression) Expression NamedExprT func(NamedExpression) NamedExpression FormulaT func(Formula) Formula }
Transformers is a structure containing functions to transform each of the physical plan components.
type Tuple ¶
type Tuple struct {
Expressions []Expression
}
TupleExpression describes an expression which is a tuple of subexpressions.
func NewTuple ¶
func NewTuple(expressions []Expression) *Tuple
func (*Tuple) Materialize ¶
func (tup *Tuple) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)
func (*Tuple) Transform ¶
func (tup *Tuple) Transform(ctx context.Context, transformers *Transformers) Expression
type UnionAll ¶
type UnionAll struct {
First, Second Node
}
func NewUnionAll ¶
func (*UnionAll) Materialize ¶
type Variable ¶
type Variable struct {
Name octosql.VariableName
}
Variables describes a variable Name.
func NewVariable ¶
func NewVariable(name octosql.VariableName) *Variable
func (*Variable) Materialize ¶
func (v *Variable) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)
func (*Variable) MaterializeNamed ¶
func (v *Variable) MaterializeNamed(ctx context.Context, matCtx *MaterializationContext) (execution.NamedExpression, error)
func (*Variable) Transform ¶
func (v *Variable) Transform(ctx context.Context, transformers *Transformers) Expression
func (*Variable) TransformNamed ¶
func (v *Variable) TransformNamed(ctx context.Context, transformers *Transformers) NamedExpression