execution

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: MIT Imports: 13 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEndOfStream = errors.New("end of stream")
View Source
var ErrNotFound = errors.New("not found")

Functions

func AreStreamsEqual

func AreStreamsEqual(first, second RecordStream) (bool, error)

func AreStreamsEqualNoOrdering

func AreStreamsEqualNoOrdering(first, second RecordStream) (bool, error)

func HashRecord

func HashRecord(rec *Record) (uint64, error)

func ParseType

func ParseType(str string) octosql.Value

ParseType tries to parse the given string into any type it succeeds to. Returns back the string on failure.

Types

type Aggregate

type Aggregate interface {
	docs.Documented
	AddRecord(key octosql.Tuple, value octosql.Value) error
	GetAggregated(key octosql.Tuple) (octosql.Value, error)
	String() string
}

type AggregatePrototype

type AggregatePrototype func() Aggregate

type AliasedExpression

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

func NewAliasedExpression

func NewAliasedExpression(name octosql.VariableName, expr Expression) *AliasedExpression

func (*AliasedExpression) ExpressionValue

func (alExpr *AliasedExpression) ExpressionValue(variables octosql.Variables) (octosql.Value, error)

func (*AliasedExpression) Name

func (alExpr *AliasedExpression) Name() octosql.VariableName

type And

type And struct {
	Left, Right Formula
}

func NewAnd

func NewAnd(left Formula, right Formula) *And

func (*And) Evaluate

func (f *And) Evaluate(variables octosql.Variables) (bool, error)

type Constant

type Constant struct {
	Value bool
}

func NewConstant

func NewConstant(value bool) *Constant

func (Constant) Evaluate

func (f Constant) Evaluate(variables octosql.Variables) (bool, error)

type Datatype

type Datatype string
const (
	DatatypeBoolean Datatype = "boolean"
	DatatypeInt     Datatype = "int"
	DatatypeFloat64 Datatype = "float64"
	DatatypeString  Datatype = "string"
	DatatypeTuple   Datatype = "octosql.Tuple"
)

func GetType

func GetType(i octosql.Value) Datatype

type Distinct

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

func NewDistinct

func NewDistinct(child Node) *Distinct

func (*Distinct) Get

func (node *Distinct) Get(variables octosql.Variables) (RecordStream, error)

type DistinctStream

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

func (*DistinctStream) Close

func (ds *DistinctStream) Close() error

func (*DistinctStream) Next

func (ds *DistinctStream) Next() (*Record, error)

type DummyNode

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

func NewDummyNode

func NewDummyNode(data []*Record) *DummyNode

func (*DummyNode) Get

func (dn *DummyNode) Get(variables octosql.Variables) (RecordStream, error)

type DummyValue

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

func NewDummyValue

func NewDummyValue(value octosql.Value) *DummyValue

func (*DummyValue) ExpressionValue

func (dv *DummyValue) ExpressionValue(variables octosql.Variables) (octosql.Value, error)

type Equal

type Equal struct {
}

func (*Equal) Apply

func (rel *Equal) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type Expression

type Expression interface {
	ExpressionValue(variables octosql.Variables) (octosql.Value, error)
}

type Field

type Field struct {
	Name octosql.VariableName
}

type Filter

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

func NewFilter

func NewFilter(formula Formula, child Node) *Filter

func (*Filter) Get

func (node *Filter) Get(variables octosql.Variables) (RecordStream, error)

type FilteredStream

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

func (*FilteredStream) Close

func (stream *FilteredStream) Close() error

func (*FilteredStream) Next

func (stream *FilteredStream) Next() (*Record, error)

type Formula

type Formula interface {
	Evaluate(variables octosql.Variables) (bool, error)
}

type Function

type Function struct {
	Name          string
	ArgumentNames [][]string
	Description   docs.Documentation
	Validator     Validator
	Logic         func(...octosql.Value) (octosql.Value, error)
}

func (*Function) Document

func (f *Function) Document() docs.Documentation

type FunctionExpression

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

func NewFunctionExpression

func NewFunctionExpression(fun *Function, args []Expression) *FunctionExpression

func (*FunctionExpression) ExpressionValue

func (fe *FunctionExpression) ExpressionValue(variables octosql.Variables) (octosql.Value, error)

type GreaterEqual

type GreaterEqual struct {
}

func (*GreaterEqual) Apply

func (rel *GreaterEqual) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type GroupBy

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

func NewGroupBy

func NewGroupBy(source Node, key []Expression, fields []octosql.VariableName, aggregatePrototypes []AggregatePrototype, as []octosql.VariableName) *GroupBy

func (*GroupBy) Get

func (node *GroupBy) Get(variables octosql.Variables) (RecordStream, error)

type GroupByStream

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

func (*GroupByStream) Close

func (stream *GroupByStream) Close() error

func (*GroupByStream) Next

func (stream *GroupByStream) Next() (*Record, error)

type HashMap

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

func NewHashMap

func NewHashMap() *HashMap

func (*HashMap) Get

func (hm *HashMap) Get(key octosql.Value) (interface{}, bool, error)

func (*HashMap) GetIterator

func (hm *HashMap) GetIterator() *Iterator

func (*HashMap) Set

func (hm *HashMap) Set(key octosql.Value, value interface{}) error

type In

type In struct {
}

func (*In) Apply

func (rel *In) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type InMemoryStream

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

func NewInMemoryStream

func NewInMemoryStream(data []*Record) *InMemoryStream

func (*InMemoryStream) Close

func (ims *InMemoryStream) Close() error

func (*InMemoryStream) Next

func (ims *InMemoryStream) Next() (*Record, error)

type InnerJoin

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

InnerJoin currently only supports lookup joins.

func NewInnerJoin

func NewInnerJoin(prefetchCount int, source Node, joined Node) *InnerJoin

func (*InnerJoin) Get

func (node *InnerJoin) Get(variables octosql.Variables) (RecordStream, error)

type InnerJoinedStream

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

func (*InnerJoinedStream) Close

func (stream *InnerJoinedStream) Close() error

func (*InnerJoinedStream) Next

func (stream *InnerJoinedStream) Next() (*Record, error)

type Iterator

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

func (*Iterator) Next

func (iter *Iterator) Next() (octosql.Value, interface{}, bool)

Next returns next key, value, exists

type Joiner added in v0.1.1

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

Joiner is used to join one source stream with another datasource.

func NewJoiner added in v0.1.1

func NewJoiner(prefetchCount int, variables octosql.Variables, sourceStream RecordStream, joined Node) *Joiner

func (*Joiner) Close added in v0.1.1

func (joiner *Joiner) Close() error

func (*Joiner) GetNextRecord added in v0.1.1

func (joiner *Joiner) GetNextRecord() (*Record, RecordStream, error)

type LeftJoin

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

LeftJoin currently only supports lookup joins.

func NewLeftJoin

func NewLeftJoin(prefetchCount int, source Node, joined Node) *LeftJoin

func (*LeftJoin) Get

func (node *LeftJoin) Get(variables octosql.Variables) (RecordStream, error)

type LeftJoinedStream

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

func (*LeftJoinedStream) Close

func (stream *LeftJoinedStream) Close() error

func (*LeftJoinedStream) Next

func (stream *LeftJoinedStream) Next() (*Record, error)

type LessEqual

type LessEqual struct {
}

func (*LessEqual) Apply

func (rel *LessEqual) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type LessThan

type LessThan struct {
}

func (*LessThan) Apply

func (rel *LessThan) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type Like

type Like struct {
}

func (*Like) Apply

func (rel *Like) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type Limit

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

func NewLimit

func NewLimit(data Node, limit Expression) *Limit

func (*Limit) Get

func (node *Limit) Get(variables octosql.Variables) (RecordStream, error)

type LimitedStream

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

func (*LimitedStream) Close

func (node *LimitedStream) Close() error

func (*LimitedStream) Next

func (node *LimitedStream) Next() (*Record, error)

type LogicExpression

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

func NewLogicExpression

func NewLogicExpression(formula Formula) *LogicExpression

func (*LogicExpression) ExpressionValue

func (le *LogicExpression) ExpressionValue(variables octosql.Variables) (octosql.Value, error)

type Map

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

func NewMap

func NewMap(expressions []NamedExpression, child Node, keep bool) *Map

func (*Map) Get

func (node *Map) Get(variables octosql.Variables) (RecordStream, error)

type MappedStream

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

func (*MappedStream) Close

func (stream *MappedStream) Close() error

func (*MappedStream) Next

func (stream *MappedStream) Next() (*Record, error)

type MoreThan

type MoreThan struct {
}

func (*MoreThan) Apply

func (rel *MoreThan) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type NamedExpression

type NamedExpression interface {
	Expression
	Name() octosql.VariableName
}

type Node

type Node interface {
	Get(variables octosql.Variables) (RecordStream, error)
}

type NodeExpression

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

func NewNodeExpression

func NewNodeExpression(node Node) *NodeExpression

func (*NodeExpression) ExpressionValue

func (ne *NodeExpression) ExpressionValue(variables octosql.Variables) (octosql.Value, error)

type Not

type Not struct {
	Child Formula
}

func NewNot

func NewNot(child Formula) *Not

func (*Not) Evaluate

func (f *Not) Evaluate(variables octosql.Variables) (bool, error)

type NotEqual

type NotEqual struct {
}

func (*NotEqual) Apply

func (rel *NotEqual) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type NotIn

type NotIn struct {
}

func (*NotIn) Apply

func (rel *NotIn) Apply(variables octosql.Variables, left, right Expression) (bool, error)

type Offset

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

func NewOffset

func NewOffset(data Node, offsetExpr Expression) *Offset

func (*Offset) Get

func (node *Offset) Get(variables octosql.Variables) (RecordStream, error)

type Or

type Or struct {
	Left, Right Formula
}

func NewOr

func NewOr(left Formula, right Formula) *Or

func (*Or) Evaluate

func (f *Or) Evaluate(variables octosql.Variables) (bool, error)

type OrderBy

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

func NewOrderBy

func NewOrderBy(exprs []Expression, directions []OrderDirection, source Node) *OrderBy

func (*OrderBy) Get

func (ob *OrderBy) Get(variables octosql.Variables) (RecordStream, error)

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) Evaluate

func (f *Predicate) Evaluate(variables octosql.Variables) (bool, error)

type Record

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

func NewRecord

func NewRecord(fields []octosql.VariableName, data map[octosql.VariableName]octosql.Value, opts ...RecordOption) *Record

func NewRecordFromSlice

func NewRecordFromSlice(fields []octosql.VariableName, data []octosql.Value, opts ...RecordOption) *Record

func NewRecordFromSliceWithNormalize

func NewRecordFromSliceWithNormalize(fields []octosql.VariableName, data []interface{}, opts ...RecordOption) *Record

func Normalize

func Normalize(rec *Record) *Record

func (*Record) AsTuple

func (r *Record) AsTuple() octosql.Tuple

func (*Record) AsVariables

func (r *Record) AsVariables() octosql.Variables

func (*Record) Equal

func (r *Record) Equal(other *Record) bool

func (*Record) EventTime added in v0.2.0

func (r *Record) EventTime() octosql.Value

func (*Record) Fields

func (r *Record) Fields() []Field

func (*Record) IsUndo added in v0.2.0

func (r *Record) IsUndo() bool

func (*Record) String added in v0.2.0

func (r *Record) String() string

func (*Record) Value

func (r *Record) Value(field octosql.VariableName) octosql.Value

type RecordOption added in v0.2.0

type RecordOption func(stream *Record)

func WithEventTime added in v0.2.0

func WithEventTime(eventTime time.Time) RecordOption

func WithMetadataFrom added in v0.2.0

func WithMetadataFrom(base *Record) RecordOption

func WithUndo added in v0.2.0

func WithUndo() RecordOption

type RecordStream

type RecordStream interface {
	Next() (*Record, error)
	io.Closer
}

type Relation

type Relation interface {
	Apply(variables octosql.Variables, left, right Expression) (bool, error)
}

func NewEqual

func NewEqual() Relation

func NewGreaterEqual

func NewGreaterEqual() Relation

func NewIn

func NewIn() Relation

func NewLessEqual

func NewLessEqual() Relation

func NewLessThan

func NewLessThan() Relation

func NewLike

func NewLike() Relation

func NewMoreThan

func NewMoreThan() Relation

func NewNotEqual

func NewNotEqual() Relation

func NewNotIn

func NewNotIn() Relation

type RequalifiedStream

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

func (*RequalifiedStream) Close

func (stream *RequalifiedStream) Close() error

func (*RequalifiedStream) Next

func (stream *RequalifiedStream) Next() (*Record, error)

type Requalifier

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

func NewRequalifier

func NewRequalifier(qualifier string, child Node) *Requalifier

func (*Requalifier) Get

func (node *Requalifier) Get(variables octosql.Variables) (RecordStream, error)

type TupleExpression

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

func NewTuple

func NewTuple(expressions []Expression) *TupleExpression

func (*TupleExpression) ExpressionValue

func (tup *TupleExpression) ExpressionValue(variables octosql.Variables) (octosql.Value, error)

type UnifiedStream

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

func (*UnifiedStream) Close

func (node *UnifiedStream) Close() error

func (*UnifiedStream) Next

func (node *UnifiedStream) Next() (*Record, error)

type UnionAll

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

func NewUnionAll

func NewUnionAll(first, second Node) *UnionAll

func (*UnionAll) Get

func (node *UnionAll) Get(variables octosql.Variables) (RecordStream, error)

type Validator

type Validator interface {
	docs.Documented
	Validate(args ...octosql.Value) error
}

type Variable

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

func NewVariable

func NewVariable(name octosql.VariableName) *Variable

func (*Variable) ExpressionValue

func (v *Variable) ExpressionValue(variables octosql.Variables) (octosql.Value, error)

func (*Variable) Name

func (v *Variable) Name() octosql.VariableName

Directories

Path Synopsis
docgen command
docgen command
tvf
docgen command

Jump to

Keyboard shortcuts

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