stream

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidResult = errors.New("expression must evaluate to a document")

ErrInvalidResult is returned when an expression supposed to evaluate to a document returns something else.

View Source
var ErrStreamClosed = errors.New("stream closed")

ErrStreamClosed is used to indicate that a stream must be closed.

Functions

This section is empty.

Types

type ConcatOperator

type ConcatOperator struct {
	Streams []*Stream
	// contains filtered or unexported fields
}

A ConcatOperator concatenates two streams.

func Concat

func Concat(s ...*Stream) *ConcatOperator

Concat turns two individual streams into one.

func (*ConcatOperator) GetNext

func (op *ConcatOperator) GetNext() Operator

func (*ConcatOperator) GetPrev

func (op *ConcatOperator) GetPrev() Operator

func (*ConcatOperator) Iterate

func (*ConcatOperator) SetNext

func (op *ConcatOperator) SetNext(o Operator)

func (*ConcatOperator) SetPrev

func (op *ConcatOperator) SetPrev(o Operator)

func (*ConcatOperator) String

func (it *ConcatOperator) String() string

type DoOperator added in v0.14.0

type DoOperator struct {
	F func(out *environment.Environment) error
	// contains filtered or unexported fields
}

func Do added in v0.14.0

func Do(f func(out *environment.Environment) error) *DoOperator

func NoOp added in v0.14.0

func NoOp() *DoOperator

func (*DoOperator) GetNext added in v0.14.0

func (op *DoOperator) GetNext() Operator

func (*DoOperator) GetPrev added in v0.14.0

func (op *DoOperator) GetPrev() Operator

func (*DoOperator) Iterate added in v0.14.0

func (op *DoOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

func (*DoOperator) SetNext added in v0.14.0

func (op *DoOperator) SetNext(o Operator)

func (*DoOperator) SetPrev added in v0.14.0

func (op *DoOperator) SetPrev(o Operator)

func (*DoOperator) String added in v0.14.0

func (op *DoOperator) String() string

type DocumentPointer added in v0.14.0

type DocumentPointer struct {
	Table *database.Table
	Doc   types.Document
	// contains filtered or unexported fields
}

DocumentPointer holds a document key and lazily loads the document on demand when the Iterate or GetByField method is called. It implements the types.Document and the document.Keyer interfaces.

func (*DocumentPointer) GetByField added in v0.14.0

func (d *DocumentPointer) GetByField(field string) (types.Value, error)

func (*DocumentPointer) Iterate added in v0.14.0

func (d *DocumentPointer) Iterate(fn func(field string, value types.Value) error) error

func (*DocumentPointer) MarshalJSON added in v0.14.0

func (d *DocumentPointer) MarshalJSON() ([]byte, error)

type DocumentsOperator

type DocumentsOperator struct {
	Docs []types.Document
	// contains filtered or unexported fields
}

func Documents

func Documents(documents ...types.Document) *DocumentsOperator

Documents creates a DocumentsOperator that iterates over the given values.

func (*DocumentsOperator) GetNext

func (op *DocumentsOperator) GetNext() Operator

func (*DocumentsOperator) GetPrev

func (op *DocumentsOperator) GetPrev() Operator

func (*DocumentsOperator) Iterate

func (*DocumentsOperator) SetNext

func (op *DocumentsOperator) SetNext(o Operator)

func (*DocumentsOperator) SetPrev

func (op *DocumentsOperator) SetPrev(o Operator)

func (*DocumentsOperator) String

func (op *DocumentsOperator) String() string

type EmitOperator added in v0.14.0

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

func Emit added in v0.14.0

func (*EmitOperator) GetNext added in v0.14.0

func (op *EmitOperator) GetNext() Operator

func (*EmitOperator) GetPrev added in v0.14.0

func (op *EmitOperator) GetPrev() Operator

func (*EmitOperator) Iterate added in v0.14.0

func (op *EmitOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

func (*EmitOperator) SetNext added in v0.14.0

func (op *EmitOperator) SetNext(o Operator)

func (*EmitOperator) SetPrev added in v0.14.0

func (op *EmitOperator) SetPrev(o Operator)

func (*EmitOperator) String added in v0.14.0

func (op *EmitOperator) String() string

type ExprsOperator

type ExprsOperator struct {
	Exprs []expr.Expr
	// contains filtered or unexported fields
}

func Expressions

func Expressions(exprs ...expr.Expr) *ExprsOperator

Expressions creates an operator that iterates over the given expressions. Each expression must evaluate to a document.

func (*ExprsOperator) GetNext

func (op *ExprsOperator) GetNext() Operator

func (*ExprsOperator) GetPrev

func (op *ExprsOperator) GetPrev() Operator

func (*ExprsOperator) Iterate

func (op *ExprsOperator) Iterate(in *environment.Environment, fn func(out *environment.Environment) error) error

func (*ExprsOperator) SetNext

func (op *ExprsOperator) SetNext(o Operator)

func (*ExprsOperator) SetPrev

func (op *ExprsOperator) SetPrev(o Operator)

func (*ExprsOperator) String

func (op *ExprsOperator) String() string

type FilterOperator

type FilterOperator struct {
	E expr.Expr
	// contains filtered or unexported fields
}

A FilterOperator filters values based on a given expression.

func Filter

func Filter(e expr.Expr) *FilterOperator

Filter evaluates e for each incoming value and filters any value whose result is not truthy.

func (*FilterOperator) GetNext

func (op *FilterOperator) GetNext() Operator

func (*FilterOperator) GetPrev

func (op *FilterOperator) GetPrev() Operator

func (*FilterOperator) Iterate

func (op *FilterOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

Iterate implements the Operator interface.

func (*FilterOperator) SetNext

func (op *FilterOperator) SetNext(o Operator)

func (*FilterOperator) SetPrev

func (op *FilterOperator) SetPrev(o Operator)

func (*FilterOperator) String

func (op *FilterOperator) String() string

type GroupAggregateOperator added in v0.14.0

type GroupAggregateOperator struct {
	Builders []expr.AggregatorBuilder
	E        expr.Expr
	// contains filtered or unexported fields
}

func GroupAggregate added in v0.14.0

func GroupAggregate(groupBy expr.Expr, builders ...expr.AggregatorBuilder) *GroupAggregateOperator

GroupAggregate consumes the incoming stream and outputs one value per group. It assumes the stream is sorted by groupBy.

func (*GroupAggregateOperator) GetNext added in v0.14.0

func (op *GroupAggregateOperator) GetNext() Operator

func (*GroupAggregateOperator) GetPrev added in v0.14.0

func (op *GroupAggregateOperator) GetPrev() Operator

func (*GroupAggregateOperator) Iterate added in v0.14.0

func (*GroupAggregateOperator) SetNext added in v0.14.0

func (op *GroupAggregateOperator) SetNext(o Operator)

func (*GroupAggregateOperator) SetPrev added in v0.14.0

func (op *GroupAggregateOperator) SetPrev(o Operator)

func (*GroupAggregateOperator) String added in v0.14.0

func (op *GroupAggregateOperator) String() string

type HandleConflictOperator added in v0.14.0

type HandleConflictOperator struct {
	OnConflict *Stream
	// contains filtered or unexported fields
}

HandleConflictOperator handles any conflicts that occur during the iteration.

func HandleConflict added in v0.14.0

func HandleConflict(onConflict *Stream) *HandleConflictOperator

func (*HandleConflictOperator) GetNext added in v0.14.0

func (op *HandleConflictOperator) GetNext() Operator

func (*HandleConflictOperator) GetPrev added in v0.14.0

func (op *HandleConflictOperator) GetPrev() Operator

func (*HandleConflictOperator) Iterate added in v0.14.0

func (*HandleConflictOperator) SetNext added in v0.14.0

func (op *HandleConflictOperator) SetNext(o Operator)

func (*HandleConflictOperator) SetPrev added in v0.14.0

func (op *HandleConflictOperator) SetPrev(o Operator)

func (*HandleConflictOperator) String added in v0.14.0

func (op *HandleConflictOperator) String() string

type IndexDeleteOperator added in v0.14.0

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

IndexDeleteOperator reads the input stream and deletes the document from the specified index.

func IndexDelete added in v0.14.0

func IndexDelete(indexName string) *IndexDeleteOperator

func (*IndexDeleteOperator) GetNext added in v0.14.0

func (op *IndexDeleteOperator) GetNext() Operator

func (*IndexDeleteOperator) GetPrev added in v0.14.0

func (op *IndexDeleteOperator) GetPrev() Operator

func (*IndexDeleteOperator) Iterate added in v0.14.0

func (*IndexDeleteOperator) SetNext added in v0.14.0

func (op *IndexDeleteOperator) SetNext(o Operator)

func (*IndexDeleteOperator) SetPrev added in v0.14.0

func (op *IndexDeleteOperator) SetPrev(o Operator)

func (*IndexDeleteOperator) String added in v0.14.0

func (op *IndexDeleteOperator) String() string

type IndexInsertOperator added in v0.14.0

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

IndexInsertOperator reads the input stream and indexes each document.

func IndexInsert added in v0.14.0

func IndexInsert(indexName string) *IndexInsertOperator

func (*IndexInsertOperator) GetNext added in v0.14.0

func (op *IndexInsertOperator) GetNext() Operator

func (*IndexInsertOperator) GetPrev added in v0.14.0

func (op *IndexInsertOperator) GetPrev() Operator

func (*IndexInsertOperator) Iterate added in v0.14.0

func (*IndexInsertOperator) SetNext added in v0.14.0

func (op *IndexInsertOperator) SetNext(o Operator)

func (*IndexInsertOperator) SetPrev added in v0.14.0

func (op *IndexInsertOperator) SetPrev(o Operator)

func (*IndexInsertOperator) String added in v0.14.0

func (op *IndexInsertOperator) String() string

type IndexScanOperator

type IndexScanOperator struct {

	// IndexName references the index that will be used to perform the scan
	IndexName string
	// Ranges defines the boundaries of the scan, each corresponding to one value of the group of values
	// being indexed in the case of a composite index.
	Ranges Ranges
	// Reverse indicates the direction used to traverse the index.
	Reverse bool
	// contains filtered or unexported fields
}

A IndexScanOperator iterates over the documents of an index.

func IndexScan

func IndexScan(name string, ranges ...Range) *IndexScanOperator

IndexScan creates an iterator that iterates over each document of the given table.

func IndexScanReverse

func IndexScanReverse(name string, ranges ...Range) *IndexScanOperator

IndexScanReverse creates an iterator that iterates over each document of the given table in reverse order.

func (*IndexScanOperator) GetNext

func (op *IndexScanOperator) GetNext() Operator

func (*IndexScanOperator) GetPrev

func (op *IndexScanOperator) GetPrev() Operator

func (*IndexScanOperator) Iterate

Iterate over the documents of the table. Each document is stored in the environment that is passed to the fn function, using SetCurrentValue.

func (*IndexScanOperator) SetNext

func (op *IndexScanOperator) SetNext(o Operator)

func (*IndexScanOperator) SetPrev

func (op *IndexScanOperator) SetPrev(o Operator)

func (*IndexScanOperator) String

func (it *IndexScanOperator) String() string

type IndexValidateOperator added in v0.14.0

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

IndexValidateOperator reads the input stream and deletes the document from the specified index.

func IndexValidate added in v0.14.0

func IndexValidate(indexName string) *IndexValidateOperator

func (*IndexValidateOperator) GetNext added in v0.14.0

func (op *IndexValidateOperator) GetNext() Operator

func (*IndexValidateOperator) GetPrev added in v0.14.0

func (op *IndexValidateOperator) GetPrev() Operator

func (*IndexValidateOperator) Iterate added in v0.14.0

func (*IndexValidateOperator) SetNext added in v0.14.0

func (op *IndexValidateOperator) SetNext(o Operator)

func (*IndexValidateOperator) SetPrev added in v0.14.0

func (op *IndexValidateOperator) SetPrev(o Operator)

func (*IndexValidateOperator) String added in v0.14.0

func (op *IndexValidateOperator) String() string

type IterRenameOperator

type IterRenameOperator struct {
	FieldNames []string
	// contains filtered or unexported fields
}

An IterRenameOperator iterates over all fields of the incoming document in order and renames them.

func IterRename

func IterRename(fieldNames ...string) *IterRenameOperator

IterRename iterates over all fields of the incoming document in order and renames them. If the number of fields of the incoming document doesn't match the number of expected fields, it returns an error.

func (*IterRenameOperator) GetNext

func (op *IterRenameOperator) GetNext() Operator

func (*IterRenameOperator) GetPrev

func (op *IterRenameOperator) GetPrev() Operator

func (*IterRenameOperator) Iterate

Iterate implements the Operator interface.

func (*IterRenameOperator) SetNext

func (op *IterRenameOperator) SetNext(o Operator)

func (*IterRenameOperator) SetPrev

func (op *IterRenameOperator) SetPrev(o Operator)

func (*IterRenameOperator) String

func (op *IterRenameOperator) String() string

type MapOperator

type MapOperator struct {
	E expr.Expr
	// contains filtered or unexported fields
}

A MapOperator applies an expression on each value of the stream and returns a new value.

func Map

func Map(e expr.Expr) *MapOperator

Map evaluates e on each value of the stream and outputs the result.

func (*MapOperator) GetNext

func (op *MapOperator) GetNext() Operator

func (*MapOperator) GetPrev

func (op *MapOperator) GetPrev() Operator

func (*MapOperator) Iterate

func (op *MapOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

Iterate implements the Operator interface.

func (*MapOperator) SetNext

func (op *MapOperator) SetNext(o Operator)

func (*MapOperator) SetPrev

func (op *MapOperator) SetPrev(o Operator)

func (*MapOperator) String

func (op *MapOperator) String() string

type MaskDocument

type MaskDocument struct {
	Env   *environment.Environment
	Exprs []expr.Expr
}

func (*MaskDocument) GetByField

func (d *MaskDocument) GetByField(field string) (v types.Value, err error)

func (*MaskDocument) Iterate

func (d *MaskDocument) Iterate(fn func(field string, value types.Value) error) error

func (*MaskDocument) MarshalJSON

func (d *MaskDocument) MarshalJSON() ([]byte, error)

func (*MaskDocument) String

func (d *MaskDocument) String() string

type Operator

type Operator interface {
	Iterate(in *environment.Environment, fn func(out *environment.Environment) error) error
	SetPrev(prev Operator)
	SetNext(next Operator)
	GetNext() Operator
	GetPrev() Operator
	String() string
}

An Operator is used to modify a stream. It takes an environment containing the current value as well as any other metadata created by other operatorsand returns a new environment which will be passed to the next operator. If it returns a nil environment, the env will be ignored. If it returns an error, the stream will be interrupted and that error will bubble up and returned by this function, unless that error is ErrStreamClosed, in which case the Iterate method will stop the iteration and return nil. Stream operators can be reused, and thus, any state or side effect should be kept within the Op closure unless the nature of the operator prevents that.

func InsertAfter

func InsertAfter(op, newOp Operator) Operator

func InsertBefore

func InsertBefore(op, newOp Operator) Operator

func Pipe

func Pipe(ops ...Operator) Operator

type OperatorFunc

type OperatorFunc func(func(env *environment.Environment) error) error

An OperatorFunc is the function that will receive each value of the stream.

type PkScanOperator

type PkScanOperator struct {
	TableName string
	Ranges    Ranges
	Reverse   bool
	// contains filtered or unexported fields
}

A PkScanOperator iterates over the documents of a table.

func PkScan

func PkScan(tableName string, ranges ...Range) *PkScanOperator

PkScan creates an iterator that iterates over each document of the given table.

func PkScanReverse

func PkScanReverse(tableName string, ranges ...Range) *PkScanOperator

PkScanReverse creates an iterator that iterates over each document of the given table in reverse order.

func (*PkScanOperator) GetNext

func (op *PkScanOperator) GetNext() Operator

func (*PkScanOperator) GetPrev

func (op *PkScanOperator) GetPrev() Operator

func (*PkScanOperator) Iterate

func (it *PkScanOperator) Iterate(in *environment.Environment, fn func(out *environment.Environment) error) error

Iterate over the documents of the table. Each document is stored in the environment that is passed to the fn function, using SetCurrentValue.

func (*PkScanOperator) SetNext

func (op *PkScanOperator) SetNext(o Operator)

func (*PkScanOperator) SetPrev

func (op *PkScanOperator) SetPrev(o Operator)

func (*PkScanOperator) String

func (it *PkScanOperator) String() string

type ProjectOperator

type ProjectOperator struct {
	Exprs []expr.Expr
	// contains filtered or unexported fields
}

A ProjectOperator applies an expression on each value of the stream and returns a new value.

func Project

func Project(exprs ...expr.Expr) *ProjectOperator

Project creates a ProjectOperator.

func (*ProjectOperator) GetNext

func (op *ProjectOperator) GetNext() Operator

func (*ProjectOperator) GetPrev

func (op *ProjectOperator) GetPrev() Operator

func (*ProjectOperator) Iterate

func (op *ProjectOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

Iterate implements the Operator interface.

func (*ProjectOperator) SetNext

func (op *ProjectOperator) SetNext(o Operator)

func (*ProjectOperator) SetPrev

func (op *ProjectOperator) SetPrev(o Operator)

func (*ProjectOperator) String

func (op *ProjectOperator) String() string

type Range added in v0.14.0

type Range struct {
	Min, Max expr.LiteralExprList
	Paths    []document.Path
	// Exclude Min and Max from the results.
	// By default, min and max are inclusive.
	// Exclusive and Exact cannot be set to true at the same time.
	Exclusive bool
	// Used to match an exact value equal to Min.
	// If set to true, Max will be ignored for comparison
	// and for determining the global upper bound.
	Exact bool
}

Range represents a range to select values after or before a given boundary.

func (*Range) Eval added in v0.14.0

func (r *Range) Eval(env *environment.Environment) (*database.Range, error)

func (*Range) IsEqual added in v0.14.0

func (r *Range) IsEqual(other *Range) bool

func (*Range) String added in v0.14.0

func (r *Range) String() string

type Ranges added in v0.14.0

type Ranges []Range

func (Ranges) Append added in v0.14.0

func (r Ranges) Append(rng Range) Ranges

Append rng to r and return the new slice. Duplicate ranges are ignored.

func (Ranges) Cost added in v0.14.0

func (r Ranges) Cost() int

Cost is a best effort function to determine the cost of a range lookup.

func (Ranges) Eval added in v0.14.0

func (r Ranges) Eval(env *environment.Environment) ([]*database.Range, error)

Encode each range using the given value encoder.

func (Ranges) String added in v0.14.0

func (r Ranges) String() string

type SeqScanOperator

type SeqScanOperator struct {
	TableName string
	Reverse   bool
	// contains filtered or unexported fields
}

A SeqScanOperator iterates over the documents of a table.

func SeqScan

func SeqScan(tableName string) *SeqScanOperator

SeqScan creates an iterator that iterates over each document of the given table.

func SeqScanReverse

func SeqScanReverse(tableName string) *SeqScanOperator

SeqScanReverse creates an iterator that iterates over each document of the given table in reverse order.

func (*SeqScanOperator) GetNext

func (op *SeqScanOperator) GetNext() Operator

func (*SeqScanOperator) GetPrev

func (op *SeqScanOperator) GetPrev() Operator

func (*SeqScanOperator) Iterate

func (it *SeqScanOperator) Iterate(in *environment.Environment, fn func(out *environment.Environment) error) error

func (*SeqScanOperator) SetNext

func (op *SeqScanOperator) SetNext(o Operator)

func (*SeqScanOperator) SetPrev

func (op *SeqScanOperator) SetPrev(o Operator)

func (*SeqScanOperator) String

func (it *SeqScanOperator) String() string

type SetOperator

type SetOperator struct {
	Path document.Path
	E    expr.Expr
	// contains filtered or unexported fields
}

A SetOperator filters duplicate documents.

func Set

func Set(path document.Path, e expr.Expr) *SetOperator

Set filters duplicate documents based on one or more expressions.

func (*SetOperator) GetNext

func (op *SetOperator) GetNext() Operator

func (*SetOperator) GetPrev

func (op *SetOperator) GetPrev() Operator

func (*SetOperator) Iterate

func (op *SetOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

Iterate implements the Operator interface.

func (*SetOperator) SetNext

func (op *SetOperator) SetNext(o Operator)

func (*SetOperator) SetPrev

func (op *SetOperator) SetPrev(o Operator)

func (*SetOperator) String

func (op *SetOperator) String() string

type SkipOperator

type SkipOperator struct {
	N int64
	// contains filtered or unexported fields
}

A SkipOperator skips the n first values of the stream.

func Skip

func Skip(n int64) *SkipOperator

Skip ignores the first n values of the stream.

func (*SkipOperator) GetNext

func (op *SkipOperator) GetNext() Operator

func (*SkipOperator) GetPrev

func (op *SkipOperator) GetPrev() Operator

func (*SkipOperator) Iterate

func (op *SkipOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

Iterate implements the Operator interface.

func (*SkipOperator) SetNext

func (op *SkipOperator) SetNext(o Operator)

func (*SkipOperator) SetPrev

func (op *SkipOperator) SetPrev(o Operator)

func (*SkipOperator) String

func (op *SkipOperator) String() string

type Stream

type Stream struct {
	Op Operator
}

func New

func New(op Operator) *Stream

func (*Stream) First

func (s *Stream) First() Operator

func (*Stream) Iterate

func (s *Stream) Iterate(in *environment.Environment, fn func(out *environment.Environment) error) error

func (*Stream) Pipe

func (s *Stream) Pipe(op Operator) *Stream

func (*Stream) Remove

func (s *Stream) Remove(op Operator)

func (*Stream) String

func (s *Stream) String() string

type TableDeleteOperator

type TableDeleteOperator struct {
	Name string
	// contains filtered or unexported fields
}

A TableDeleteOperator replaces documents in the table

func TableDelete

func TableDelete(tableName string) *TableDeleteOperator

TableDelete deletes documents from the table. Incoming documents must implement the document.Keyer interface.

func (*TableDeleteOperator) GetNext

func (op *TableDeleteOperator) GetNext() Operator

func (*TableDeleteOperator) GetPrev

func (op *TableDeleteOperator) GetPrev() Operator

func (*TableDeleteOperator) Iterate

Iterate implements the Operator interface.

func (*TableDeleteOperator) SetNext

func (op *TableDeleteOperator) SetNext(o Operator)

func (*TableDeleteOperator) SetPrev

func (op *TableDeleteOperator) SetPrev(o Operator)

func (*TableDeleteOperator) String

func (op *TableDeleteOperator) String() string

type TableInsertOperator

type TableInsertOperator struct {
	Name string
	// contains filtered or unexported fields
}

A TableInsertOperator inserts incoming documents to the table.

func TableInsert

func TableInsert(tableName string) *TableInsertOperator

TableInsert inserts incoming documents to the table.

func (*TableInsertOperator) GetNext

func (op *TableInsertOperator) GetNext() Operator

func (*TableInsertOperator) GetPrev

func (op *TableInsertOperator) GetPrev() Operator

func (*TableInsertOperator) Iterate

Iterate implements the Operator interface.

func (*TableInsertOperator) SetNext

func (op *TableInsertOperator) SetNext(o Operator)

func (*TableInsertOperator) SetPrev

func (op *TableInsertOperator) SetPrev(o Operator)

func (*TableInsertOperator) String

func (op *TableInsertOperator) String() string

type TableReplaceOperator

type TableReplaceOperator struct {
	Name string
	// contains filtered or unexported fields
}

A TableReplaceOperator replaces documents in the table

func TableReplace

func TableReplace(tableName string) *TableReplaceOperator

TableReplace replaces documents in the table. Incoming documents must implement the document.Keyer interface.

func (*TableReplaceOperator) GetNext

func (op *TableReplaceOperator) GetNext() Operator

func (*TableReplaceOperator) GetPrev

func (op *TableReplaceOperator) GetPrev() Operator

func (*TableReplaceOperator) Iterate

Iterate implements the Operator interface.

func (*TableReplaceOperator) SetNext

func (op *TableReplaceOperator) SetNext(o Operator)

func (*TableReplaceOperator) SetPrev

func (op *TableReplaceOperator) SetPrev(o Operator)

func (*TableReplaceOperator) String

func (op *TableReplaceOperator) String() string

type TableValidateOperator added in v0.14.0

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

TableValidateOperator validates and converts incoming documents against table and field constraints.

func TableValidate added in v0.14.0

func TableValidate(tableName string) *TableValidateOperator

func (*TableValidateOperator) GetNext added in v0.14.0

func (op *TableValidateOperator) GetNext() Operator

func (*TableValidateOperator) GetPrev added in v0.14.0

func (op *TableValidateOperator) GetPrev() Operator

func (*TableValidateOperator) Iterate added in v0.14.0

func (*TableValidateOperator) SetNext added in v0.14.0

func (op *TableValidateOperator) SetNext(o Operator)

func (*TableValidateOperator) SetPrev added in v0.14.0

func (op *TableValidateOperator) SetPrev(o Operator)

func (*TableValidateOperator) String added in v0.14.0

func (op *TableValidateOperator) String() string

type TakeOperator

type TakeOperator struct {
	N int64
	// contains filtered or unexported fields
}

A TakeOperator closes the stream after a certain number of values.

func Take

func Take(n int64) *TakeOperator

Take closes the stream after n values have passed through the operator.

func (*TakeOperator) GetNext

func (op *TakeOperator) GetNext() Operator

func (*TakeOperator) GetPrev

func (op *TakeOperator) GetPrev() Operator

func (*TakeOperator) Iterate

func (op *TakeOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

Iterate implements the Operator interface.

func (*TakeOperator) SetNext

func (op *TakeOperator) SetNext(o Operator)

func (*TakeOperator) SetPrev

func (op *TakeOperator) SetPrev(o Operator)

func (*TakeOperator) String

func (op *TakeOperator) String() string

type TempTreeSortOperator added in v0.14.0

type TempTreeSortOperator struct {
	Expr expr.Expr
	Desc bool
	// contains filtered or unexported fields
}

A TempTreeSortOperator consumes every value of the stream and outputs them in order.

func TempTreeSort added in v0.14.0

func TempTreeSort(e expr.Expr) *TempTreeSortOperator

TempTreeSort consumes every value of the stream, sorts them by the given expr and outputs them in order. It creates a temporary index and uses it to sort the stream.

func TempTreeSortReverse added in v0.14.0

func TempTreeSortReverse(e expr.Expr) *TempTreeSortOperator

TempTreeSortReverse does the same as TempTreeSort but in descending order.

func (*TempTreeSortOperator) GetNext added in v0.14.0

func (op *TempTreeSortOperator) GetNext() Operator

func (*TempTreeSortOperator) GetPrev added in v0.14.0

func (op *TempTreeSortOperator) GetPrev() Operator

func (*TempTreeSortOperator) Iterate added in v0.14.0

func (*TempTreeSortOperator) SetNext added in v0.14.0

func (op *TempTreeSortOperator) SetNext(o Operator)

func (*TempTreeSortOperator) SetPrev added in v0.14.0

func (op *TempTreeSortOperator) SetPrev(o Operator)

func (*TempTreeSortOperator) String added in v0.14.0

func (op *TempTreeSortOperator) String() string

type UnionOperator added in v0.14.0

type UnionOperator struct {
	Streams []*Stream
	// contains filtered or unexported fields
}

UnionOperator is an operator that merges the results of multiple operators.

func Union added in v0.14.0

func Union(s ...*Stream) *UnionOperator

Union returns a new UnionOperator.

func (*UnionOperator) GetNext added in v0.14.0

func (op *UnionOperator) GetNext() Operator

func (*UnionOperator) GetPrev added in v0.14.0

func (op *UnionOperator) GetPrev() Operator

func (*UnionOperator) Iterate added in v0.14.0

func (it *UnionOperator) Iterate(in *environment.Environment, fn func(out *environment.Environment) error) (err error)

Iterate iterates over all the streams and returns their union.

func (*UnionOperator) SetNext added in v0.14.0

func (op *UnionOperator) SetNext(o Operator)

func (*UnionOperator) SetPrev added in v0.14.0

func (op *UnionOperator) SetPrev(o Operator)

func (*UnionOperator) String added in v0.14.0

func (it *UnionOperator) String() string

type UnsetOperator

type UnsetOperator struct {
	Field string
	// contains filtered or unexported fields
}

A UnsetOperator filters duplicate documents.

func Unset

func Unset(field string) *UnsetOperator

Unset filters duplicate documents based on one or more expressions.

func (*UnsetOperator) GetNext

func (op *UnsetOperator) GetNext() Operator

func (*UnsetOperator) GetPrev

func (op *UnsetOperator) GetPrev() Operator

func (*UnsetOperator) Iterate

func (op *UnsetOperator) Iterate(in *environment.Environment, f func(out *environment.Environment) error) error

Iterate implements the Operator interface.

func (*UnsetOperator) SetNext

func (op *UnsetOperator) SetNext(o Operator)

func (*UnsetOperator) SetPrev

func (op *UnsetOperator) SetPrev(o Operator)

func (*UnsetOperator) String

func (op *UnsetOperator) String() string

Jump to

Keyboard shortcuts

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