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 TableValuedFunction
- type TableValuedFunctionArgumentValue
- type TableValuedFunctionArgumentValueDescriptor
- type TableValuedFunctionArgumentValueExpression
- type TableValuedFunctionArgumentValueTable
- 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
// This field will be used to decide on join strategies or if the source is a stream.
Cardinality metadata.Cardinality
}
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) Metadata ¶ added in v0.2.0
func (dsb *DataSourceBuilder) Metadata() *metadata.NodeMetadata
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{}, cardinality metadata.Cardinality) 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 {
Source Node
}
func NewDistinct ¶
func (*Distinct) Materialize ¶
func (*Distinct) Metadata ¶ added in v0.2.0
func (node *Distinct) Metadata() *metadata.NodeMetadata
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 ¶
func (*Filter) Metadata ¶ added in v0.2.0
func (node *Filter) Metadata() *metadata.NodeMetadata
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 ¶
func (*GroupBy) Metadata ¶ added in v0.2.0
func (node *GroupBy) Metadata() *metadata.NodeMetadata
type InnerJoin ¶
func NewInnerJoin ¶
func (*InnerJoin) Materialize ¶
func (*InnerJoin) Metadata ¶ added in v0.2.0
func (node *InnerJoin) Metadata() *metadata.NodeMetadata
type LeftJoin ¶
func NewLeftJoin ¶
func (*LeftJoin) Materialize ¶
func (*LeftJoin) Metadata ¶ added in v0.2.0
func (node *LeftJoin) Metadata() *metadata.NodeMetadata
type Limit ¶
type Limit struct {
Source Node
LimitExpr Expression
}
func NewLimit ¶
func NewLimit(data Node, expr Expression) *Limit
func (*Limit) Materialize ¶
func (*Limit) Metadata ¶ added in v0.2.0
func (node *Limit) Metadata() *metadata.NodeMetadata
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 ¶
func (*Map) Metadata ¶ added in v0.2.0
func (node *Map) Metadata() *metadata.NodeMetadata
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)
Metadata() *metadata.NodeMetadata
}
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 {
Source Node
OffsetExpr Expression
}
func NewOffset ¶
func NewOffset(data Node, expr Expression) *Offset
func (*Offset) Materialize ¶
func (*Offset) Metadata ¶ added in v0.2.0
func (node *Offset) Metadata() *metadata.NodeMetadata
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 ¶
func (*OrderBy) Metadata ¶ added in v0.2.0
func (node *OrderBy) Metadata() *metadata.NodeMetadata
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) Metadata ¶ added in v0.2.0
func (node *Requalifier) Metadata() *metadata.NodeMetadata
func (*Requalifier) Transform ¶
func (node *Requalifier) Transform(ctx context.Context, transformers *Transformers) Node
type TableValuedFunction ¶ added in v0.2.0
type TableValuedFunction struct {
Name string
Arguments map[octosql.VariableName]TableValuedFunctionArgumentValue
}
func NewTableValuedFunction ¶ added in v0.2.0
func NewTableValuedFunction(name string, args map[octosql.VariableName]TableValuedFunctionArgumentValue) *TableValuedFunction
func (*TableValuedFunction) Materialize ¶ added in v0.2.0
func (node *TableValuedFunction) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)
func (*TableValuedFunction) Metadata ¶ added in v0.2.0
func (node *TableValuedFunction) Metadata() *metadata.NodeMetadata
func (*TableValuedFunction) Transform ¶ added in v0.2.0
func (node *TableValuedFunction) Transform(ctx context.Context, transformers *Transformers) Node
type TableValuedFunctionArgumentValue ¶ added in v0.2.0
type TableValuedFunctionArgumentValue interface {
Transform(ctx context.Context, transformers *Transformers) TableValuedFunctionArgumentValue
// contains filtered or unexported methods
}
type TableValuedFunctionArgumentValueDescriptor ¶ added in v0.2.0
type TableValuedFunctionArgumentValueDescriptor struct {
Descriptor octosql.VariableName
}
func NewTableValuedFunctionArgumentValueDescriptor ¶ added in v0.2.0
func NewTableValuedFunctionArgumentValueDescriptor(descriptor octosql.VariableName) *TableValuedFunctionArgumentValueDescriptor
func (*TableValuedFunctionArgumentValueDescriptor) Transform ¶ added in v0.2.0
func (arg *TableValuedFunctionArgumentValueDescriptor) Transform(ctx context.Context, transformers *Transformers) TableValuedFunctionArgumentValue
type TableValuedFunctionArgumentValueExpression ¶ added in v0.2.0
type TableValuedFunctionArgumentValueExpression struct {
Expression Expression
}
func NewTableValuedFunctionArgumentValueExpression ¶ added in v0.2.0
func NewTableValuedFunctionArgumentValueExpression(expression Expression) *TableValuedFunctionArgumentValueExpression
func (*TableValuedFunctionArgumentValueExpression) Transform ¶ added in v0.2.0
func (arg *TableValuedFunctionArgumentValueExpression) Transform(ctx context.Context, transformers *Transformers) TableValuedFunctionArgumentValue
type TableValuedFunctionArgumentValueTable ¶ added in v0.2.0
type TableValuedFunctionArgumentValueTable struct {
Source Node
}
func NewTableValuedFunctionArgumentValueTable ¶ added in v0.2.0
func NewTableValuedFunctionArgumentValueTable(source Node) *TableValuedFunctionArgumentValueTable
func (*TableValuedFunctionArgumentValueTable) Transform ¶ added in v0.2.0
func (arg *TableValuedFunctionArgumentValueTable) Transform(ctx context.Context, transformers *Transformers) TableValuedFunctionArgumentValue
type Transformers ¶
type Transformers struct {
NodeT func(Node) Node
ExprT func(Expression) Expression
NamedExprT func(NamedExpression) NamedExpression
FormulaT func(Formula) Formula
TableValuedFunctionArgumentValueT func(TableValuedFunctionArgumentValue) TableValuedFunctionArgumentValue
}
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 ¶
func (*UnionAll) Metadata ¶ added in v0.2.0
func (node *UnionAll) Metadata() *metadata.NodeMetadata
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