Documentation ¶
Overview ¶
TODO: the context here maybe need to be initialized with proper values like fs
Index ¶
- Constants
- Variables
- func ASTBranchFromValue(b Tuple) ast.Branch
- func ASTLeafFromValue(s String) ast.Leaf
- func ASTNodeFromValue(value Value) ast.Node
- func AssertEqualValues(t *testing.T, expected, actual Value) bool
- func AssertExprErrorEquals(t *testing.T, expr Expr, msg string) bool
- func AssertExprErrors(t *testing.T, expr Expr) bool
- func AssertExprEvalsToType(t *testing.T, expected interface{}, expr Expr) bool
- func AssertExprPanics(t *testing.T, expr Expr) bool
- func AssertExprsEvalToSameValue(t *testing.T, expected, expr Expr) bool
- func AttrEnumeratorToMap(e AttrEnumerator) map[string]Value
- func Combine(a, b Tuple, op CombineOp) map[string]Pair
- func DictTupleMatcher() func(v Value) (key, value Value, matches bool)
- func EqualValues(expected, actual Value) bool
- func Joiner(combine func(common Names, a, b Tuple) Tuple, ...) func(a, b Set) (Set, error)
- func MakeBinValExpr(op string, eval valueEval) func(scanner parser.Scanner, a, b Expr) Expr
- func MarshalToJSON(value Value) []byte
- func NewSeqArrowExpr(withAt bool) func(scanner parser.Scanner, lhs Expr, fn Expr) Expr
- func RequireEqualValues(t *testing.T, expected, actual Value)
- func RequireExprsEvalToSameValue(t *testing.T, expected, expr Expr)
- func TupleNameRepr(name string) string
- func TupleOrderedNames(t *GenericTuple) []string
- func ValueLess(a, b Value) bool
- func ValueTypeAsString(v Value) string
- func WrapContextErr(err error, expr Expr, scope Scope) error
- type AndExpr
- type Array
- func (a Array) ArrayEnumerator() ValueEnumerator
- func (a Array) CallAll(_ context.Context, arg Value, b SetBuilder) error
- func (a Array) Count() int
- func (a Array) Enumerator() ValueEnumerator
- func (a Array) Equal(v interface{}) bool
- func (a Array) Eval(ctx context.Context, _ Scope) (Value, error)
- func (a Array) Export(ctx context.Context) interface{}
- func (a Array) Format(f fmt.State, verb rune)
- func (a Array) Has(value Value) bool
- func (a Array) Hash(seed uintptr) uintptr
- func (a Array) IsTrue() bool
- func (a Array) Kind() int
- func (a Array) Less(v Value) bool
- func (a Array) Map(f func(v Value) (Value, error)) (Set, error)
- func (a Array) Negate() Value
- func (a Array) Shift(offset int) Array
- func (a Array) Source() parser.Scanner
- func (a Array) String() string
- func (a Array) Values() []Value
- func (a Array) Where(p func(v Value) (bool, error)) (Set, error)
- func (a Array) With(value Value) Set
- func (a Array) Without(value Value) Set
- type ArrayExpr
- type ArrayItemTuple
- func (t ArrayItemTuple) Count() int
- func (t ArrayItemTuple) Enumerator() AttrEnumerator
- func (t ArrayItemTuple) Equal(v interface{}) bool
- func (t ArrayItemTuple) Eval(ctx context.Context, local Scope) (Value, error)
- func (t ArrayItemTuple) Export(ctx context.Context) interface{}
- func (t ArrayItemTuple) Format(f fmt.State, verb rune)
- func (t ArrayItemTuple) Get(name string) (Value, bool)
- func (t ArrayItemTuple) HasName(name string) bool
- func (t ArrayItemTuple) Hash(seed uintptr) uintptr
- func (t ArrayItemTuple) IsTrue() bool
- func (t ArrayItemTuple) Kind() int
- func (t ArrayItemTuple) Less(v Value) bool
- func (t ArrayItemTuple) Map(f func(Value) (Value, error)) (Tuple, error)
- func (t ArrayItemTuple) MustGet(name string) Value
- func (t ArrayItemTuple) Names() Names
- func (t ArrayItemTuple) Negate() Value
- func (t ArrayItemTuple) Project(names Names) Tuple
- func (t ArrayItemTuple) Source() parser.Scanner
- func (t ArrayItemTuple) String() string
- func (t ArrayItemTuple) With(name string, value Value) Tuple
- func (t ArrayItemTuple) Without(name string) Tuple
- type ArrayItemTupleExpr
- type ArrayPattern
- type ArrowExpr
- type Attr
- func AttrEnumeratorToSlice(e AttrEnumerator) []Attr
- func NewAttr(name string, value Value) Attr
- func NewBoolAttr(name string, value bool) Attr
- func NewFloatAttr(name string, value float64) Attr
- func NewIntAttr(name string, value int) Attr
- func NewNativeFunctionAttr(name string, fn NativeFnBody) Attr
- func NewStringAttr(name string, value []rune) Attr
- func NewTupleAttr(name string, attrs ...Attr) Attr
- func NewUintAttr(name string, value uint64) Attr
- type AttrEnumerator
- type AttrExpr
- type BinExpr
- type Bytes
- func (b Bytes) ArrayEnumerator() ValueEnumerator
- func (b Bytes) Bytes() []byte
- func (b Bytes) CallAll(_ context.Context, arg Value, sb SetBuilder) error
- func (b Bytes) Count() int
- func (b Bytes) Enumerator() ValueEnumerator
- func (b Bytes) Equal(v interface{}) bool
- func (b Bytes) EqualBytes(c Bytes) bool
- func (b Bytes) Eval(ctx context.Context, _ Scope) (Value, error)
- func (b Bytes) Export(_ context.Context) interface{}
- func (b Bytes) Format(f fmt.State, verb rune)
- func (b Bytes) Has(value Value) bool
- func (b Bytes) Hash(seed uintptr) uintptr
- func (b Bytes) IsTrue() bool
- func (b Bytes) Kind() int
- func (b Bytes) Less(v Value) bool
- func (b Bytes) Map(f func(v Value) (Value, error)) (Set, error)
- func (b Bytes) Negate() Value
- func (b Bytes) Source() parser.Scanner
- func (b Bytes) String() string
- func (b Bytes) Where(p func(v Value) (bool, error)) (Set, error)
- func (b Bytes) With(value Value) Set
- func (b Bytes) Without(value Value) Set
- type BytesByteTuple
- func (t BytesByteTuple) Count() int
- func (t BytesByteTuple) Enumerator() AttrEnumerator
- func (t BytesByteTuple) Equal(v interface{}) bool
- func (t BytesByteTuple) Eval(ctx context.Context, local Scope) (Value, error)
- func (t BytesByteTuple) Export(_ context.Context) interface{}
- func (t BytesByteTuple) Format(f fmt.State, verb rune)
- func (t BytesByteTuple) Get(name string) (Value, bool)
- func (t BytesByteTuple) HasName(name string) bool
- func (t BytesByteTuple) Hash(seed uintptr) uintptr
- func (t BytesByteTuple) IsTrue() bool
- func (t BytesByteTuple) Kind() int
- func (t BytesByteTuple) Less(v Value) bool
- func (t BytesByteTuple) Map(f func(Value) (Value, error)) (Tuple, error)
- func (t BytesByteTuple) MustGet(name string) Value
- func (t BytesByteTuple) Names() Names
- func (t BytesByteTuple) Negate() Value
- func (t BytesByteTuple) Project(names Names) Tuple
- func (t BytesByteTuple) Source() parser.Scanner
- func (t BytesByteTuple) String() string
- func (t BytesByteTuple) With(name string, value Value) Tuple
- func (t BytesByteTuple) Without(name string) Tuple
- type BytesEnumerator
- type BytesExpr
- type Closure
- func (c Closure) ArrayEnumerator() ValueEnumerator
- func (c Closure) CallAll(ctx context.Context, arg Value, b SetBuilder) error
- func (c Closure) Count() int
- func (c Closure) Enumerator() ValueEnumerator
- func (c Closure) Equal(i interface{}) bool
- func (c Closure) EqualClosure(d Closure) bool
- func (c Closure) Eval(ctx context.Context, local Scope) (Value, error)
- func (c Closure) Export(ctx context.Context) interface{}
- func (c Closure) Format(f fmt.State, verb rune)
- func (c Closure) Has(v Value) bool
- func (c Closure) Hash(seed uintptr) uintptr
- func (c Closure) IsTrue() bool
- func (c Closure) Kind() int
- func (c Closure) Less(d Value) bool
- func (c Closure) Map(f func(v Value) (Value, error)) (Set, error)
- func (c Closure) Negate() Value
- func (c Closure) Source() parser.Scanner
- func (c Closure) String() string
- func (c Closure) Where(p func(v Value) (bool, error)) (Set, error)
- func (c Closure) With(v Value) Set
- func (c Closure) Without(v Value) Set
- type CombineOp
- type CompareExpr
- type CompareFunc
- type CondExpr
- type CondPatternControlVarExpr
- type ContextErr
- type DArrowExpr
- type Dict
- func (d Dict) ArrayEnumerator() ValueEnumerator
- func (d Dict) CallAll(_ context.Context, arg Value, b SetBuilder) error
- func (d Dict) Count() int
- func (d Dict) DictEnumerator() *DictEnumerator
- func (d Dict) Enumerator() ValueEnumerator
- func (d Dict) Equal(v interface{}) bool
- func (d Dict) Eval(ctx context.Context, local Scope) (Value, error)
- func (d Dict) Export(_ context.Context) interface{}
- func (d Dict) Format(f fmt.State, verb rune)
- func (d Dict) Has(v Value) bool
- func (d Dict) Hash(seed uintptr) uintptr
- func (d Dict) IsTrue() bool
- func (d Dict) Kind() int
- func (d Dict) Less(v Value) bool
- func (d Dict) Map(f func(v Value) (Value, error)) (Set, error)
- func (d Dict) Negate() Value
- func (d Dict) OrderedEntries() []DictEntryTuple
- func (d Dict) Source() parser.Scanner
- func (d Dict) String() string
- func (d Dict) Where(p func(v Value) (bool, error)) (Set, error)
- func (d Dict) With(v Value) Set
- func (d Dict) Without(v Value) Set
- type DictEntryTuple
- func (t DictEntryTuple) Count() int
- func (t DictEntryTuple) Enumerator() AttrEnumerator
- func (t DictEntryTuple) Equal(v interface{}) bool
- func (t DictEntryTuple) Eval(ctx context.Context, local Scope) (Value, error)
- func (t DictEntryTuple) Export(ctx context.Context) interface{}
- func (t DictEntryTuple) Format(f fmt.State, verb rune)
- func (t DictEntryTuple) Get(name string) (Value, bool)
- func (t DictEntryTuple) HasName(name string) bool
- func (t DictEntryTuple) Hash(seed uintptr) uintptr
- func (t DictEntryTuple) IsTrue() bool
- func (t DictEntryTuple) Kind() int
- func (t DictEntryTuple) Less(v Value) bool
- func (t DictEntryTuple) Map(f func(Value) (Value, error)) (Tuple, error)
- func (t DictEntryTuple) MustGet(name string) Value
- func (t DictEntryTuple) Names() Names
- func (t DictEntryTuple) Negate() Value
- func (t DictEntryTuple) Project(names Names) Tuple
- func (t DictEntryTuple) Source() parser.Scanner
- func (t DictEntryTuple) String() string
- func (t DictEntryTuple) With(name string, value Value) Tuple
- func (t DictEntryTuple) Without(name string) Tuple
- type DictEntryTupleExpr
- type DictEnumerator
- type DictExpr
- type DictPattern
- type DictPatternEntry
- type DotExpr
- type DynIdent
- type DynIdentExpr
- type DynIdentPattern
- type DynLetExpr
- type EmptySet
- func (e EmptySet) ArrayEnumerator() ValueEnumerator
- func (e EmptySet) CallAll(context.Context, Value, SetBuilder) error
- func (e EmptySet) Count() int
- func (e EmptySet) Enumerator() ValueEnumerator
- func (e EmptySet) Equal(i interface{}) bool
- func (e EmptySet) Eval(ctx context.Context, local Scope) (Value, error)
- func (e EmptySet) Export(context.Context) interface{}
- func (e EmptySet) Format(f fmt.State, verb rune)
- func (e EmptySet) Has(Value) bool
- func (e EmptySet) Hash(seed uintptr) uintptr
- func (e EmptySet) IsTrue() bool
- func (e EmptySet) Kind() int
- func (e EmptySet) Less(v Value) bool
- func (e EmptySet) Map(func(Value) (Value, error)) (Set, error)
- func (e EmptySet) Negate() Value
- func (e EmptySet) Source() parser.Scanner
- func (e EmptySet) String() string
- func (e EmptySet) Where(func(Value) (bool, error)) (Set, error)
- func (e EmptySet) With(v Value) Set
- func (e EmptySet) Without(Value) Set
- type Expr
- func NewAddArrowExpr(scanner parser.Scanner, lhs, rhs Expr) Expr
- func NewAddExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewAndExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewArrayExpr(scanner parser.Scanner, elements ...Expr) Expr
- func NewArrowExpr(scanner parser.Scanner, lhs, fn Expr) Expr
- func NewBytesExpr(scanner parser.Scanner, elements ...Expr) Expr
- func NewCallExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewCallExprCurry(scanner parser.Scanner, f Expr, args ...Expr) Expr
- func NewComposeExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewConcatExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewCondExpr(scanner parser.Scanner, dict Expr) Expr
- func NewCondPatternControlVarExpr(scanner parser.Scanner, controlVar Expr, patternExprs ...PatternExprPair) Expr
- func NewCountExpr(scanner parser.Scanner, a Expr) Expr
- func NewDArrowExpr(scanner parser.Scanner, lhs Expr, fn Expr) Expr
- func NewDictExpr(scanner parser.Scanner, allowDupKeys bool, dictExprAlways bool, ...) (Expr, error)
- func NewDiffExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewDivExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewDotExpr(scanner parser.Scanner, lhs Expr, attr string) Expr
- func NewDotIdent(source parser.Scanner) Expr
- func NewDynLetExpr(scanner parser.Scanner, bindings, expr Expr) Expr
- func NewEvalExpr(scanner parser.Scanner, a Expr) Expr
- func NewFunction(scanner parser.Scanner, arg Pattern, body Expr) Expr
- func NewIdentExpr(scanner parser.Scanner, ident string) Expr
- func NewIdivExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewIfElseExpr(scanner parser.Scanner, ifTrue, cond, ifFalse Expr) Expr
- func NewIntersectExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewJoinCommonExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewJoinExistsExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewJoinExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewLeftMatchExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewLeftResidueExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewMaxExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewMeanExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewMedianExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewMinExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewModExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewMulExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewNegExpr(scanner parser.Scanner, a Expr) Expr
- func NewNestExpr(scanner parser.Scanner, inverse bool, lhs Expr, attrs Names, attr string) Expr
- func NewNotExpr(scanner parser.Scanner, a Expr) Expr
- func NewOffsetExpr(scanner parser.Scanner, n, s Expr) Expr
- func NewOrExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewOrderByExpr(scanner parser.Scanner, a, key Expr) Expr
- func NewOrderExpr(scanner parser.Scanner, a, key Expr) Expr
- func NewPosExpr(scanner parser.Scanner, a Expr) Expr
- func NewPowExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewPowerSetExpr(scanner parser.Scanner, a Expr) Expr
- func NewRankExpr(scanner parser.Scanner, a, key Expr) Expr
- func NewRecursionExpr(scanner parser.Scanner, name string, fn Expr, fix, fixt Value) Expr
- func NewReduceExpr(scanner parser.Scanner, a Expr, f *Function, format string, ...) Expr
- func NewRelationExpr(scanner parser.Scanner, names []string, tuples ...[]Expr) (Expr, error)
- func NewRightMatchExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewRightResidueExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewSafeTailExpr(scanner parser.Scanner, fallback, base Expr, tailExprs []SafeTailCallback) Expr
- func NewSetExpr(scanner parser.Scanner, elements ...Expr) (Expr, error)
- func NewSingleExpr(scanner parser.Scanner, a Expr) Expr
- func NewSingleNestExpr(scanner parser.Scanner, lhs Expr, attr string) Expr
- func NewSubExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewSubModExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewSumExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewSymmDiffExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewTupleExpr(scanner parser.Scanner, attrs ...AttrExpr) Expr
- func NewTupleExprFromMap(scanner parser.Scanner, attrMap map[string]Expr) Expr
- func NewTupleMapExpr(scanner parser.Scanner, lhs Expr, fn Expr) Expr
- func NewTupleProjectExpr(scanner parser.Scanner, base Expr, inverse bool, attrs []string) Expr
- func NewUnionExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewUnnestExpr(scanner parser.Scanner, lhs Expr, attr string) Expr
- func NewWhereExpr(scanner parser.Scanner, a, pred Expr) Expr
- func NewWithExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewWithoutExpr(scanner parser.Scanner, a, b Expr) Expr
- type ExprClosure
- func (ExprClosure) ArrayEnumerator() ValueEnumerator
- func (c ExprClosure) CallAll(_ context.Context, arg Value, b SetBuilder) error
- func (ExprClosure) Count() int
- func (ExprClosure) Enumerator() ValueEnumerator
- func (c ExprClosure) Equal(i interface{}) bool
- func (c ExprClosure) EqualExprClosure(d ExprClosure) bool
- func (c ExprClosure) Eval(ctx context.Context, _ Scope) (Value, error)
- func (c ExprClosure) Export(ctx context.Context) interface{}
- func (c ExprClosure) Format(f fmt.State, verb rune)
- func (ExprClosure) Has(Value) bool
- func (c ExprClosure) Hash(seed uintptr) uintptr
- func (c ExprClosure) IsTrue() bool
- func (c ExprClosure) Kind() int
- func (c ExprClosure) Less(d Value) bool
- func (ExprClosure) Map(func(Value) (Value, error)) (Set, error)
- func (c ExprClosure) Negate() Value
- func (c ExprClosure) Source() parser.Scanner
- func (c ExprClosure) String() string
- func (ExprClosure) Where(p func(v Value) (bool, error)) (Set, error)
- func (c ExprClosure) With(Value) Set
- func (ExprClosure) Without(Value) Set
- type ExprExpr
- type ExprPattern
- type ExprScanner
- type ExprsPattern
- type ExtraElementPattern
- type FallbackPattern
- type Function
- func (f *Function) Arg() string
- func (f *Function) Body() Expr
- func (f *Function) Equal(i interface{}) bool
- func (f *Function) EqualFunction(g *Function) bool
- func (f *Function) Eval(ctx context.Context, local Scope) (Value, error)
- func (f *Function) Format(s fmt.State, verb rune)
- func (f *Function) Hash(seed uintptr) uintptr
- func (f *Function) String() string
- type GenericSet
- func (s GenericSet) Any() Value
- func (s GenericSet) ArrayEnumerator() ValueEnumerator
- func (s GenericSet) CallAll(_ context.Context, arg Value, b SetBuilder) error
- func (s GenericSet) Count() int
- func (s GenericSet) Enumerator() ValueEnumerator
- func (s GenericSet) Equal(v interface{}) bool
- func (s GenericSet) Eval(ctx context.Context, local Scope) (Value, error)
- func (s GenericSet) Export(ctx context.Context) interface{}
- func (s GenericSet) Format(f fmt.State, verb rune)
- func (s GenericSet) Has(value Value) bool
- func (s GenericSet) Hash(seed uintptr) uintptr
- func (s GenericSet) IsTrue() bool
- func (s GenericSet) Kind() int
- func (s GenericSet) Less(v Value) bool
- func (s GenericSet) Map(f func(v Value) (Value, error)) (Set, error)
- func (s GenericSet) Negate() Value
- func (s GenericSet) OrderedValues() ValueEnumerator
- func (s GenericSet) Source() parser.Scanner
- func (s GenericSet) String() string
- func (s GenericSet) Where(p func(v Value) (bool, error)) (_ Set, err error)
- func (s GenericSet) With(v Value) Set
- func (s GenericSet) Without(value Value) Set
- type GenericTuple
- func (t *GenericTuple) Canonical() Tuple
- func (t *GenericTuple) Count() int
- func (t *GenericTuple) Enumerator() AttrEnumerator
- func (t *GenericTuple) Equal(v interface{}) bool
- func (t *GenericTuple) Eval(ctx context.Context, local Scope) (Value, error)
- func (t *GenericTuple) Export(ctx context.Context) interface{}
- func (t *GenericTuple) Format(f fmt.State, verb rune)
- func (t *GenericTuple) Get(name string) (Value, bool)
- func (t *GenericTuple) HasName(name string) bool
- func (t *GenericTuple) Hash(seed uintptr) uintptr
- func (t *GenericTuple) IsTrue() bool
- func (t *GenericTuple) Kind() int
- func (t *GenericTuple) Less(v Value) bool
- func (t *GenericTuple) Map(f func(Value) (Value, error)) (Tuple, error)
- func (t *GenericTuple) MustGet(name string) Value
- func (t *GenericTuple) Names() Names
- func (t *GenericTuple) Negate() Value
- func (t *GenericTuple) Project(names Names) Tuple
- func (t *GenericTuple) Source() parser.Scanner
- func (t *GenericTuple) String() string
- func (t *GenericTuple) With(name string, value Value) Tuple
- func (t *GenericTuple) Without(name string) Tuple
- type GenericTupleEnumerator
- type IdentExpr
- type IdentPattern
- type IfElseExpr
- type Less
- type Let
- type LiteralExpr
- type LiteralMatcher
- type MatchInt
- type Matcher
- type MissingAttrError
- type Names
- func (n Names) Any() string
- func (n Names) Count() int
- func (n Names) Enumerator() *NamesEnumerator
- func (n Names) Equal(i interface{}) bool
- func (n Names) Has(name string) bool
- func (n Names) Hash(seed uint32) uint32
- func (n Names) Intersect(o Names) Names
- func (n Names) IsSubsetOf(o Names) bool
- func (n Names) IsTrue() bool
- func (n Names) Minus(o Names) Names
- func (n Names) Names() []string
- func (n Names) OrderedNames() []string
- func (n Names) String() string
- func (n Names) TheOne() string
- func (n Names) ToSlice() []string
- func (n Names) With(name string) Names
- func (n Names) Without(name string) Names
- type NamesEnumerator
- type NamesSlice
- type NativeFnBody
- type NativeFunction
- func (*NativeFunction) ArrayEnumerator() ValueEnumerator
- func (f *NativeFunction) CallAll(ctx context.Context, arg Value, b SetBuilder) error
- func (*NativeFunction) Count() int
- func (*NativeFunction) Enumerator() ValueEnumerator
- func (f *NativeFunction) Equal(i interface{}) bool
- func (f *NativeFunction) Eval(ctx context.Context, local Scope) (Value, error)
- func (f *NativeFunction) Export(_ context.Context) interface{}
- func (f *NativeFunction) Format(s fmt.State, verb rune)
- func (*NativeFunction) Has(Value) bool
- func (f *NativeFunction) Hash(seed uintptr) uintptr
- func (f *NativeFunction) IsTrue() bool
- func (f *NativeFunction) Kind() int
- func (f *NativeFunction) Less(g Value) bool
- func (*NativeFunction) Map(func(Value) (Value, error)) (Set, error)
- func (f *NativeFunction) Name() string
- func (f *NativeFunction) Negate() Value
- func (f *NativeFunction) Source() parser.Scanner
- func (f *NativeFunction) String() string
- func (*NativeFunction) Where(p func(v Value) (bool, error)) (Set, error)
- func (*NativeFunction) With(Value) Set
- func (*NativeFunction) Without(Value) Set
- type NestExpr
- type NoReturnError
- type Number
- func (n Number) Equal(v interface{}) bool
- func (n Number) Eval(ctx context.Context, _ Scope) (Value, error)
- func (n Number) Export(_ context.Context) interface{}
- func (n Number) Float64() float64
- func (n Number) Format(f fmt.State, verb rune)
- func (n Number) Hash(seed uintptr) uintptr
- func (n Number) Int() (int, bool)
- func (n Number) IsTrue() bool
- func (n Number) Kind() int
- func (n Number) Less(v Value) bool
- func (n Number) Negate() Value
- func (n Number) Source() parser.Scanner
- func (n Number) String() string
- type OffsetExpr
- type OrExpr
- type OrderableSet
- type Pair
- type Pattern
- type PatternExprPair
- type RecursionExpr
- type ReduceExpr
- type Relation
- func (r Relation) ArrayEnumerator() ValueEnumerator
- func (r Relation) AttrsName() NamesSlice
- func (r Relation) CallAll(_ context.Context, v Value, sb SetBuilder) error
- func (r Relation) Count() int
- func (r Relation) Enumerator() ValueEnumerator
- func (r Relation) Equal(i interface{}) bool
- func (r Relation) EqualRelation(r2 Relation) bool
- func (r Relation) Eval(ctx context.Context, local Scope) (Value, error)
- func (r Relation) Export(ctx context.Context) interface{}
- func (r Relation) Format(f fmt.State, verb rune)
- func (r Relation) Has(v Value) bool
- func (r Relation) Hash(seed uintptr) uintptr
- func (r Relation) IsTrue() bool
- func (r Relation) Join(r2 Relation, keys, leftOutput, rightOutput NamesSlice) Set
- func (r Relation) Kind() int
- func (r Relation) Less(v Value) bool
- func (r Relation) Map(f func(Value) (Value, error)) (Set, error)
- func (r Relation) Negate() Value
- func (r Relation) OrderedValues() ValueEnumerator
- func (r Relation) OrderedValuesEnumerator(names NamesSlice) *RelationValuesEnumerator
- func (r Relation) Source() parser.Scanner
- func (r Relation) String() string
- func (r Relation) Where(p func(Value) (bool, error)) (_ Set, err error)
- func (r Relation) With(v Value) Set
- func (r Relation) Without(v Value) Set
- type RelationValuesEnumerator
- type SafeTailCallback
- type SafeTailExpr
- type Scope
- func (s Scope) Count() int
- func (s Scope) Enumerator() *ScopeEnumerator
- func (s Scope) Eval(ctx context.Context, local Scope) (Value, error)
- func (s Scope) Get(name string) (Expr, bool)
- func (s Scope) MatchedUpdate(t Scope) (Scope, error)
- func (s Scope) MatchedWith(name string, expr Expr) (Scope, error)
- func (s Scope) MustGet(name string) Expr
- func (s Scope) Names() []string
- func (s Scope) OrderedNames() []string
- func (s Scope) Project(names Names) (Scope, error)
- func (s Scope) String() string
- func (s Scope) Update(t Scope) Scope
- func (s Scope) With(name string, expr Expr) Scope
- func (s Scope) Without(name ...string) Scope
- type ScopeEnumerator
- type SeqArrowExpr
- type Set
- func CanonicalSet(s Set) Set
- func Concatenate(a, b Set) (Set, error)
- func Difference(a, b Set) Set
- func GenericJoin(a, b Set, getKey func(value Value) Value, join func(key Value, a, b Set) Set) Set
- func Intersect(a, b Set) Set
- func MustNewDict(allowDupKeys bool, entries ...DictEntryTuple) Set
- func MustNewSet(values ...Value) Set
- func NConcatenate(a Set, bs ...Set) (Set, error)
- func NIntersect(a Set, bs ...Set) Set
- func NUnion(sets ...Set) Set
- func Nest(a Set, relAttrs, attrs Names, attr string) Set
- func NewArray(values ...Value) Set
- func NewBool(b bool) Set
- func NewBytes(b []byte) Set
- func NewDict(allowDupKeys bool, entries ...DictEntryTuple) (Set, error)
- func NewOffsetArray(offset int, values ...Value) Set
- func NewOffsetBytes(b []byte, offset int) Set
- func NewOffsetString(s []rune, offset int) Set
- func NewSet(values ...Value) (Set, error)
- func NewSetFrom(intfs ...interface{}) (Set, error)
- func NewString(s []rune) Set
- func PowerSet(s Set) (Set, error)
- func Rank(s Set, rankerf func(v Tuple) (Tuple, error)) (Set, error)
- func Reduce(a Set, getKey func(value Value) Value, reduce func(key Value, tuples Set) Set) Set
- func SingleAttrNest(a Set, relAttrs Names, attr string) Set
- func SymmetricDifference(a, b Set) Set
- func Union(a, b Set) Set
- func Unnest(a Set, attr string) (Set, error)
- type SetBuilder
- type SetExpr
- type SetPattern
- type SingleNestExpr
- type String
- func (s String) ArrayEnumerator() ValueEnumerator
- func (s String) CallAll(_ context.Context, arg Value, b SetBuilder) error
- func (s String) Count() int
- func (s String) Enumerator() ValueEnumerator
- func (s String) Equal(v interface{}) bool
- func (s String) EqualString(t String) bool
- func (s String) Eval(ctx context.Context, _ Scope) (Value, error)
- func (s String) Export(_ context.Context) interface{}
- func (s String) Format(f fmt.State, verb rune)
- func (s String) Has(value Value) bool
- func (s String) Hash(seed uintptr) uintptr
- func (s String) IsTrue() bool
- func (s String) Kind() int
- func (s String) Less(v Value) bool
- func (s String) Map(f func(v Value) (Value, error)) (Set, error)
- func (s String) Negate() Value
- func (s String) Source() parser.Scanner
- func (s String) String() string
- func (s String) Where(p func(v Value) (bool, error)) (Set, error)
- func (s String) With(value Value) Set
- func (s String) Without(value Value) Set
- type StringCharTuple
- func (t StringCharTuple) Count() int
- func (t StringCharTuple) Enumerator() AttrEnumerator
- func (t StringCharTuple) Equal(v interface{}) bool
- func (t StringCharTuple) Eval(ctx context.Context, local Scope) (Value, error)
- func (t StringCharTuple) Export(_ context.Context) interface{}
- func (t StringCharTuple) Format(f fmt.State, verb rune)
- func (t StringCharTuple) Get(name string) (Value, bool)
- func (t StringCharTuple) HasName(name string) bool
- func (t StringCharTuple) Hash(seed uintptr) uintptr
- func (t StringCharTuple) IsTrue() bool
- func (t StringCharTuple) Kind() int
- func (t StringCharTuple) Less(v Value) bool
- func (t StringCharTuple) Map(f func(Value) (Value, error)) (Tuple, error)
- func (t StringCharTuple) MustGet(name string) Value
- func (t StringCharTuple) Names() Names
- func (t StringCharTuple) Negate() Value
- func (t StringCharTuple) Project(names Names) Tuple
- func (t StringCharTuple) Source() parser.Scanner
- func (t StringCharTuple) String() string
- func (t StringCharTuple) With(name string, value Value) Tuple
- func (t StringCharTuple) Without(name string) Tuple
- type StringCharTupleExpr
- type TrueSet
- func (t TrueSet) ArrayEnumerator() ValueEnumerator
- func (TrueSet) CallAll(context.Context, Value, SetBuilder) error
- func (TrueSet) Count() int
- func (TrueSet) Enumerator() ValueEnumerator
- func (TrueSet) Equal(i interface{}) bool
- func (t TrueSet) Eval(ctx context.Context, local Scope) (Value, error)
- func (TrueSet) Export(context.Context) interface{}
- func (TrueSet) Format(f fmt.State, verb rune)
- func (TrueSet) Has(v Value) bool
- func (TrueSet) Hash(seed uintptr) uintptr
- func (TrueSet) IsTrue() bool
- func (TrueSet) Kind() int
- func (t TrueSet) Less(v Value) bool
- func (TrueSet) Map(f func(Value) (Value, error)) (Set, error)
- func (t TrueSet) Negate() Value
- func (TrueSet) Source() parser.Scanner
- func (TrueSet) String() string
- func (t TrueSet) Where(p func(Value) (bool, error)) (Set, error)
- func (t TrueSet) With(v Value) Set
- func (t TrueSet) Without(v Value) Set
- type Tuple
- func ASTBranchToValue(b ast.Branch) Tuple
- func Merge(a, b Tuple) Tuple
- func MergeLeftToRight(t Tuple, ts ...Tuple) Tuple
- func MergeTuples(tuple Tuple, tuple2 Tuple) Tuple
- func NewTuple(attrs ...Attr) Tuple
- func NewTupleFromMap(m map[string]interface{}) (Tuple, error)
- func NewXML(tag []rune, attrs []Attr, children ...Value) Tuple
- func TupleProjectAllBut(t Tuple, names Names) Tuple
- type TupleBuilder
- type TupleExpr
- type TupleMapExpr
- type TupleMatcher
- type TuplePattern
- type TuplePatternAttr
- type TupleProjectExpr
- type UnaryExpr
- type UnionSet
- func (u UnionSet) ArrayEnumerator() ValueEnumerator
- func (u UnionSet) CallAll(ctx context.Context, arg Value, sb SetBuilder) error
- func (u UnionSet) Count() int
- func (u UnionSet) Enumerator() ValueEnumerator
- func (u UnionSet) Equal(s interface{}) bool
- func (u UnionSet) Eval(ctx context.Context, local Scope) (Value, error)
- func (u UnionSet) Export(ctx context.Context) interface{}
- func (u UnionSet) Format(f fmt.State, verb rune)
- func (u UnionSet) Has(v Value) bool
- func (u UnionSet) Hash(seed uintptr) uintptr
- func (u UnionSet) IsTrue() bool
- func (u UnionSet) Kind() int
- func (u UnionSet) Less(v Value) bool
- func (u UnionSet) Map(f func(Value) (Value, error)) (Set, error)
- func (u UnionSet) Negate() Value
- func (u UnionSet) OrderedValues() ValueEnumerator
- func (u UnionSet) Source() parser.Scanner
- func (u UnionSet) String() string
- func (u UnionSet) Where(f func(Value) (bool, error)) (Set, error)
- func (u UnionSet) With(v Value) Set
- func (u UnionSet) Without(v Value) Set
- type UnnestExpr
- type Value
- func ASTLeafToValue(l ast.Leaf) Value
- func ASTNodeToValue(n ast.Node) Value
- func Call(ctx context.Context, a, b Value, _ Scope) (Value, error)
- func NewExprClosure(scope Scope, e Expr) Value
- func NewNativeFunction(name string, fn NativeFnBody) Value
- func NewNativeLambda(fn NativeFnBody) Value
- func NewValue(v interface{}) (Value, error)
- func OrderBy(s Set, key func(v Value) (Value, error), less func(a, b Value) bool) ([]Value, error)
- func SetCall(ctx context.Context, s Set, arg Value) (Value, error)
- func UnmarshalFromJSON(data []byte) (Value, error)
- func ValueEnumeratorToSlice(e ValueEnumerator) []Value
- type ValueEnumerator
- type ValueList
- type Values
Constants ¶
const ArrayItemAttr = "@item"
const BytesByteAttr = "@byte"
BytesByteAttr is the standard name for the value-attr of a character tuple.
const DictValueAttr = "@value"
const StringCharAttr = "@char"
StringCharAttr is the standard name for the value-attr of a character tuple.
Variables ¶
genericSet equivalents for Boolean true and false
var EmptyNames = Names(frozen.Set{})
EmptyNames is the empty set of names.
var LexerNamePat = `([$@A-Za-z_][0-9$@A-Za-z_]*)`
LexerNamePat defines valid unquoted identifiers. This really belongs in rel/syntax/lex.go, but that creates a dep cycle.
Functions ¶
func ASTBranchFromValue ¶
func ASTLeafFromValue ¶
func ASTNodeFromValue ¶
func AssertEqualValues ¶
AssertEqualValues asserts that the two values are Equal.
func AssertExprErrorEquals ¶ added in v0.27.0
AssertExprErrorEquals asserts that the expr returns an error with the given message when evaluated.
func AssertExprErrors ¶ added in v0.27.0
AssertExprErrors asserts that the expr returns an error when evaluated.
func AssertExprEvalsToType ¶
AssertExprEvalsToType asserts that the exprs evaluate to the same value.
func AssertExprPanics ¶
AssertExprPanics asserts that the expr panics when evaluated.
func AssertExprsEvalToSameValue ¶
AssertExprsEvalToSameValue asserts that the exprs evaluate to the same value.
func AttrEnumeratorToMap ¶
func AttrEnumeratorToMap(e AttrEnumerator) map[string]Value
AttrEnumeratorToMap transcribes its Attrs in a map.
func Combine ¶
Combine returns a map of names to pairs of corresponding Values from a and b. Which names appear in the output is determined by the masks provided in op.
func DictTupleMatcher ¶
func EqualValues ¶
func Joiner ¶ added in v0.106.0
func Joiner( combine func(common Names, a, b Tuple) Tuple, partitionNames func(left, right, common NamesSlice) (leftOut, rightOut NamesSlice), ) func(a, b Set) (Set, error)
Joiner returns a function that computes the relational join of a and b.
Defn: Join(a{x…,y…}, b{y…,z…}) = ∀{x…,y…,z…}: {x…,y…} ∈ a ∧ {y…,z…} ∈ b
for mutually disjoint x…, y…, z…
The combine function determines how to combine matching tuples from a and b. The partitionName function determines the columns that are to be included in the output based from left and right Relations. The function is only called when both Sets are Relations.
func MakeBinValExpr ¶
MakeBinValExpr returns a function that creates a binExpr for the given logical operator.
func MarshalToJSON ¶
MarshalToJSON marshals the given value to JSON with sets escaped as s -> {"{||}": s}.
func NewSeqArrowExpr ¶ added in v0.36.0
NewSequenceMapExpr returns a new SequenceMapExpr.
func RequireEqualValues ¶
RequireEqualValues requires that the two values are Equal.
func RequireExprsEvalToSameValue ¶
RequireExprsEvalToSameValue requires that the exprs evaluate to the same value.
func TupleNameRepr ¶
func TupleOrderedNames ¶
func TupleOrderedNames(t *GenericTuple) []string
TupleOrderedNames returns the names of this tuple in sorted order.
func ValueTypeAsString ¶ added in v0.182.0
ValueTypeAsString returns a string that describes the type of the value in a human-readable form.
Types ¶
type AndExpr ¶
type AndExpr struct { ExprScanner // contains filtered or unexported fields }
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array is an ordered collection of Values.
func (Array) ArrayEnumerator ¶
func (a Array) ArrayEnumerator() ValueEnumerator
func (Array) Enumerator ¶
func (a Array) Enumerator() ValueEnumerator
Enumerator returns an enumerator over the Values in the Array.
func (Array) Less ¶
Less returns true iff v is not a number or tuple, or v is a tuple and t precedes v in a lexicographical comparison of their name/value pairs.
func (Array) Values ¶
Values returns the slice of values in the array. Holes in the indices are represented by nil elements.
Callers must not reassign elements of the returned slice.
func (Array) With ¶
With returns the original Array with given value added. Iff the value was already present, the original Array is returned.
Where value is an ArrayItemTuple, its item is inserted at its at index. If a value is already present at the index, this is an error.
func (Array) Without ¶
Without returns the original Array without the given value. Iff the value was already absent, the original Array is returned.
Value is expected to be an ArrayItemTuple; no other values can be present in an array, so any other type will be a no-op. Both the value's at (index) and item must exactly match an element of the array in order to remove it.
type ArrayExpr ¶
type ArrayExpr struct { ExprScanner // contains filtered or unexported fields }
ArrayExpr represents an expr that evaluates to an Array.
type ArrayItemTuple ¶
type ArrayItemTuple struct {
// contains filtered or unexported fields
}
ArrayItemTuple represents a tuple of the form (@: at, @item: item).
func NewArrayItemTuple ¶
func NewArrayItemTuple(at int, item Value) ArrayItemTuple
NewArrayItemTuple constructs a CharTuple.
func (ArrayItemTuple) Count ¶
func (t ArrayItemTuple) Count() int
Count returns how many attributes are in the Tuple.
func (ArrayItemTuple) Enumerator ¶
func (t ArrayItemTuple) Enumerator() AttrEnumerator
Enumerator returns an enumerator over the Values in the CharTuple.
func (ArrayItemTuple) Equal ¶
func (t ArrayItemTuple) Equal(v interface{}) bool
Equal tests two Tuples for equality. Any other type returns false.
func (ArrayItemTuple) Export ¶
func (t ArrayItemTuple) Export(ctx context.Context) interface{}
Export exports a Tuple.
func (ArrayItemTuple) Format ¶ added in v0.291.0
func (t ArrayItemTuple) Format(f fmt.State, verb rune)
func (ArrayItemTuple) Get ¶
func (t ArrayItemTuple) Get(name string) (Value, bool)
Get returns the Value associated with a name, and true iff it was found.
func (ArrayItemTuple) HasName ¶
func (t ArrayItemTuple) HasName(name string) bool
HasName returns true iff the Tuple has an attribute with the given name.
func (ArrayItemTuple) Hash ¶
func (t ArrayItemTuple) Hash(seed uintptr) uintptr
Hash computes a hash for a CharTuple.
func (ArrayItemTuple) IsTrue ¶
func (t ArrayItemTuple) IsTrue() bool
Bool returns true iff the tuple has attributes.
func (ArrayItemTuple) Kind ¶
func (t ArrayItemTuple) Kind() int
Kind returns a number that is unique for each major kind of Value.
func (ArrayItemTuple) Less ¶
func (t ArrayItemTuple) Less(v Value) bool
Less returns true iff v is not a number or tuple, or v is a tuple and t precedes v in a lexicographical comparison of their name/value pairs.
func (ArrayItemTuple) MustGet ¶
func (t ArrayItemTuple) MustGet(name string) Value
MustGet returns e.Get(name) or panics if an error occurs.
func (ArrayItemTuple) Names ¶
func (t ArrayItemTuple) Names() Names
Names returns the attribute names.
func (ArrayItemTuple) Negate ¶
func (t ArrayItemTuple) Negate() Value
func (ArrayItemTuple) Project ¶
func (t ArrayItemTuple) Project(names Names) Tuple
Project returns a tuple with the given names from this tuple, or nil if any name wasn't found.
func (ArrayItemTuple) Source ¶
func (t ArrayItemTuple) Source() parser.Scanner
Source returns a scanner locating the ArrayItemTuple's source code.
func (ArrayItemTuple) String ¶
func (t ArrayItemTuple) String() string
String returns a string representation of a Tuple.
func (ArrayItemTuple) With ¶
func (t ArrayItemTuple) With(name string, value Value) Tuple
With returns a Tuple with all name/Value pairs in t (except the one for the given name, if present) with the addition of the given name/Value pair.
func (ArrayItemTuple) Without ¶
func (t ArrayItemTuple) Without(name string) Tuple
Without returns a Tuple with all name/Value pairs in t exception the one of the given name.
type ArrayItemTupleExpr ¶
type ArrayItemTupleExpr struct { ExprScanner // contains filtered or unexported fields }
ArrayItemTupleExpr represents an expr that evaluates to an ArrayItemTuple.
func NewArrayItemTupleExpr ¶
func NewArrayItemTupleExpr(scanner parser.Scanner, at, value Expr) ArrayItemTupleExpr
NewArrayItemTupleExpr returns a new ArrayItemTupleExpr.
func (ArrayItemTupleExpr) String ¶
func (e ArrayItemTupleExpr) String() string
String returns a string representation of the expression.
type ArrayPattern ¶
type ArrayPattern struct {
// contains filtered or unexported fields
}
func NewArrayPattern ¶
func NewArrayPattern(elements ...FallbackPattern) ArrayPattern
func (ArrayPattern) Bindings ¶ added in v0.71.0
func (p ArrayPattern) Bindings() []string
func (ArrayPattern) String ¶
func (p ArrayPattern) String() string
type ArrowExpr ¶
type ArrowExpr struct { ExprScanner // contains filtered or unexported fields }
ArrowExpr returns the tuple applied to a function.
type Attr ¶
Attr is a name/Value pair used to construct a Tuple.
func AttrEnumeratorToSlice ¶
func AttrEnumeratorToSlice(e AttrEnumerator) []Attr
AttrEnumeratorToSlice transcribes its Attrs in a slice.
func NewBoolAttr ¶
NewBoolAttr return an attr with a bool value.
func NewFloatAttr ¶
NewFloatAttr return an attr with a float value.
func NewIntAttr ¶
NewIntAttr return an attr with an int value.
func NewNativeFunctionAttr ¶
func NewNativeFunctionAttr(name string, fn NativeFnBody) Attr
NewNativeFunctionAttr returns a new Attr with a named key and NativeFunction value.
func NewStringAttr ¶
NewStringAttr return an attr with a string value.
func NewTupleAttr ¶
NewTupleAttr return an attr with a new tuple value.
func NewUintAttr ¶ added in v0.280.0
NewIuntAttr return an attr for a uint64 value.
type AttrEnumerator ¶
AttrEnumerator enumerates Values.
type AttrExpr ¶
type AttrExpr struct { ExprScanner // contains filtered or unexported fields }
AttrExpr represents a single name:expr in a TupleExpr.
func NewAttrExpr ¶
NewAttrExpr constructs a new AttrExpr from the given arguments.
func NewWildcardExpr ¶
NewWildcardExpr constructs a new wildcard AttrExpr.
func (*AttrExpr) IsWildcard ¶
IsWildcard returns true iff the AttrExpr is a wildcard expression.
type BinExpr ¶
type BinExpr struct { ExprScanner // contains filtered or unexported fields }
BinExpr represents a range of operators.
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
Bytes is a set of Values.
func (Bytes) ArrayEnumerator ¶
func (b Bytes) ArrayEnumerator() ValueEnumerator
func (Bytes) Enumerator ¶
func (b Bytes) Enumerator() ValueEnumerator
Enumerator returns an enumerator over the Values in the Bytes.
func (Bytes) EqualBytes ¶ added in v0.238.0
func (Bytes) Less ¶
Less returns true iff v is not a number or tuple, or v is a tuple and t precedes v in a lexicographical comparison of their name/value pairs.
type BytesByteTuple ¶
type BytesByteTuple struct {
// contains filtered or unexported fields
}
BytesByteTuple represents a tuple of the form (@: at, @byte: byteval).
func NewBytesByteTuple ¶
func NewBytesByteTuple(at int, byteval byte) BytesByteTuple
NewBytesByteTuple constructs a BytesByteTuple.
func (BytesByteTuple) Count ¶
func (t BytesByteTuple) Count() int
Count returns how many attributes are in the Tuple.
func (BytesByteTuple) Enumerator ¶
func (t BytesByteTuple) Enumerator() AttrEnumerator
Enumerator returns an enumerator over the Values in the BytesByteTuple.
func (BytesByteTuple) Equal ¶
func (t BytesByteTuple) Equal(v interface{}) bool
Equal tests two Tuples for equality. Any other type returns false.
func (BytesByteTuple) Export ¶
func (t BytesByteTuple) Export(_ context.Context) interface{}
Export exports a Tuple.
func (BytesByteTuple) Format ¶ added in v0.291.0
func (t BytesByteTuple) Format(f fmt.State, verb rune)
Format formats a BytesByteTuple.
func (BytesByteTuple) Get ¶
func (t BytesByteTuple) Get(name string) (Value, bool)
Get returns the Value associated with a name, and true iff it was found.
func (BytesByteTuple) HasName ¶
func (t BytesByteTuple) HasName(name string) bool
HasName returns true iff the Tuple has an attribute with the given name.
func (BytesByteTuple) Hash ¶
func (t BytesByteTuple) Hash(seed uintptr) uintptr
Hash computes a hash for a BytesByteTuple.
func (BytesByteTuple) IsTrue ¶
func (t BytesByteTuple) IsTrue() bool
Bool returns true iff the tuple has attributes.
func (BytesByteTuple) Kind ¶
func (t BytesByteTuple) Kind() int
Kind returns a number that is unique for each major kind of Value.
func (BytesByteTuple) Less ¶
func (t BytesByteTuple) Less(v Value) bool
Less returns true iff v is not a number or tuple, or v is a tuple and t precedes v in a lexicographical comparison of their name/value pairs.
func (BytesByteTuple) MustGet ¶
func (t BytesByteTuple) MustGet(name string) Value
MustGet returns e.Get(name) or panics if an error occurs.
func (BytesByteTuple) Names ¶
func (t BytesByteTuple) Names() Names
Names returns the attribute names.
func (BytesByteTuple) Negate ¶
func (t BytesByteTuple) Negate() Value
func (BytesByteTuple) Project ¶
func (t BytesByteTuple) Project(names Names) Tuple
Project returns a tuple with the given names from this tuple, or nil if any name wasn't found.
func (BytesByteTuple) Source ¶
func (t BytesByteTuple) Source() parser.Scanner
Source returns a scanner locating the BytesByteTuple's source code.
func (BytesByteTuple) String ¶
func (t BytesByteTuple) String() string
String returns a string representation of a BytesByteTuple.
func (BytesByteTuple) With ¶
func (t BytesByteTuple) With(name string, value Value) Tuple
With returns a Tuple with all name/Value pairs in t (except the one for the given name, if present) with the addition of the given name/Value pair.
func (BytesByteTuple) Without ¶
func (t BytesByteTuple) Without(name string) Tuple
Without returns a Tuple with all name/Value pairs in t exception the one of the given name.
type BytesEnumerator ¶
type BytesEnumerator struct {
// contains filtered or unexported fields
}
BytesEnumerator represents an enumerator over a Bytes.
func (*BytesEnumerator) Current ¶
func (e *BytesEnumerator) Current() Value
Current returns the enumerator'b current Value.
func (*BytesEnumerator) MoveNext ¶
func (e *BytesEnumerator) MoveNext() bool
MoveNext moves the enumerator to the next Value.
type BytesExpr ¶ added in v0.3.0
type BytesExpr struct { ExprScanner // contains filtered or unexported fields }
BytesExpr is an expression that evaluates to a Byte Array
type Closure ¶
type Closure struct {
// contains filtered or unexported fields
}
Closure represents the closure of a function over a scope.
func NewClosure ¶
NewFunction returns a new function.
func (Closure) ArrayEnumerator ¶ added in v0.3.0
func (c Closure) ArrayEnumerator() ValueEnumerator
func (Closure) Enumerator ¶ added in v0.3.0
func (c Closure) Enumerator() ValueEnumerator
func (Closure) EqualClosure ¶
Equal tests two Values for equality. Any other type returns false.
type CompareExpr ¶
type CompareExpr struct { ExprScanner // contains filtered or unexported fields }
CompareExpr represents a range of operators.
func NewCompareExpr ¶
func NewCompareExpr(scanner parser.Scanner, args []Expr, comps []CompareFunc, ops []string) CompareExpr
func (CompareExpr) String ¶
func (e CompareExpr) String() string
String returns a string representation of the expression.
type CompareFunc ¶
type CondExpr ¶
type CondExpr struct { ExprScanner // contains filtered or unexported fields }
CondExpr returns the tuple applied to a function, the expression looks like: cond (1 > 0: 2 + 1, 3 > 4: 5, _: 10). The original keyword was switch (SwitchExpr), and finally it was chanaged from switch to cond. The keyword cond is more unusual, therefore less likely to be chosen as a regular name, and avoids accidental comparisons with the switch statement in other languages.
type CondPatternControlVarExpr ¶ added in v0.3.0
type CondPatternControlVarExpr struct { ExprScanner // contains filtered or unexported fields }
CondPatternControlVarExpr which is used for `cond` pattern matching.
func (CondPatternControlVarExpr) Conditions ¶ added in v0.163.0
func (e CondPatternControlVarExpr) Conditions() []PatternExprPair
Conditions returns the cond's conditions.
func (CondPatternControlVarExpr) Control ¶ added in v0.163.0
func (e CondPatternControlVarExpr) Control() Expr
Control returns the cond's control expr.
func (CondPatternControlVarExpr) Eval ¶ added in v0.3.0
Eval evaluates to find the first valid condition and return its value.
func (CondPatternControlVarExpr) String ¶ added in v0.3.0
func (e CondPatternControlVarExpr) String() string
type ContextErr ¶ added in v0.4.0
type ContextErr struct {
// contains filtered or unexported fields
}
ContextErr represents the whole stack frame of an error from arrai script.
func NewContextErr ¶ added in v0.59.0
func NewContextErr(err error, source parser.Scanner, scope Scope) ContextErr
NewContextErr creates a ContextErr.
func (ContextErr) Error ¶ added in v0.4.0
func (c ContextErr) Error() string
func (ContextErr) GetImportantFrames ¶ added in v0.59.0
func (c ContextErr) GetImportantFrames() []ContextErr
GetImportantFrames returns an array of important frames whose last element is the last frame near the point of failure. Important frames are frames that don't contain the frame under it.
func (ContextErr) GetLastScope ¶ added in v0.4.0
func (c ContextErr) GetLastScope() Scope
GetLastScope gets the scope nearest to the error
func (ContextErr) GetScope ¶ added in v0.59.0
func (c ContextErr) GetScope() Scope
GetScope gets the scope of a ContextErr.
func (ContextErr) GetSource ¶ added in v0.59.0
func (c ContextErr) GetSource() parser.Scanner
GetSource gets the source of a ContextErr.
func (ContextErr) NextErr ¶ added in v0.8.0
func (c ContextErr) NextErr() error
NextErr returns the error contained in ContextErr
type DArrowExpr ¶
type DArrowExpr struct { ExprScanner // contains filtered or unexported fields }
DArrowExpr returns the set applied elementwise to a function.
func (*DArrowExpr) String ¶
func (e *DArrowExpr) String() string
String returns a string representation of the expression.
type Dict ¶
type Dict struct {
// contains filtered or unexported fields
}
Dict is a map from keys to values.
func (Dict) ArrayEnumerator ¶
func (d Dict) ArrayEnumerator() ValueEnumerator
func (Dict) DictEnumerator ¶
func (d Dict) DictEnumerator() *DictEnumerator
func (Dict) Enumerator ¶
func (d Dict) Enumerator() ValueEnumerator
func (Dict) OrderedEntries ¶
func (d Dict) OrderedEntries() []DictEntryTuple
type DictEntryTuple ¶
type DictEntryTuple struct {
// contains filtered or unexported fields
}
DictEntryTuple represents a tuple of the form (@: at, @value: item).
func NewDictEntryTuple ¶
func NewDictEntryTuple(at Value, item Value) DictEntryTuple
NewDictEntryTuple constructs a CharTuple.
func (DictEntryTuple) Count ¶
func (t DictEntryTuple) Count() int
Count returns how many attributes are in the Tuple.
func (DictEntryTuple) Enumerator ¶
func (t DictEntryTuple) Enumerator() AttrEnumerator
Enumerator returns an enumerator over the Values in the CharTuple.
func (DictEntryTuple) Equal ¶
func (t DictEntryTuple) Equal(v interface{}) bool
Equal tests two Tuples for equality. Any other type returns false.
func (DictEntryTuple) Export ¶
func (t DictEntryTuple) Export(ctx context.Context) interface{}
Export exports a Tuple.
func (DictEntryTuple) Format ¶ added in v0.291.0
func (t DictEntryTuple) Format(f fmt.State, verb rune)
Format formats a DictEntryTuple.
func (DictEntryTuple) Get ¶
func (t DictEntryTuple) Get(name string) (Value, bool)
Get returns the Value associated with a name, and true iff it was found.
func (DictEntryTuple) HasName ¶
func (t DictEntryTuple) HasName(name string) bool
HasName returns true iff the Tuple has an attribute with the given name.
func (DictEntryTuple) Hash ¶
func (t DictEntryTuple) Hash(seed uintptr) uintptr
Hash computes a hash for a CharTuple.
func (DictEntryTuple) IsTrue ¶
func (t DictEntryTuple) IsTrue() bool
Bool returns true iff the tuple has attributes.
func (DictEntryTuple) Kind ¶
func (t DictEntryTuple) Kind() int
Kind returns a number that is unique for each major kind of Value.
func (DictEntryTuple) Less ¶
func (t DictEntryTuple) Less(v Value) bool
Less returns true iff v is not a number or tuple, or v is a tuple and t precedes v in a lexicographical comparison of their name/value pairs.
func (DictEntryTuple) MustGet ¶
func (t DictEntryTuple) MustGet(name string) Value
MustGet returns e.Get(name) or panics if an error occurs.
func (DictEntryTuple) Names ¶
func (t DictEntryTuple) Names() Names
Names returns the attribute names.
func (DictEntryTuple) Negate ¶
func (t DictEntryTuple) Negate() Value
func (DictEntryTuple) Project ¶
func (t DictEntryTuple) Project(names Names) Tuple
Project returns a tuple with the given names from this tuple, or nil if any name wasn't found.
func (DictEntryTuple) Source ¶
func (t DictEntryTuple) Source() parser.Scanner
Source returns a scanner locating the DictEntryTuple's source code.
func (DictEntryTuple) String ¶
func (t DictEntryTuple) String() string
String returns a string representation of a DictEntryTuple.
func (DictEntryTuple) With ¶
func (t DictEntryTuple) With(name string, value Value) Tuple
With returns a Tuple with all name/Value pairs in t (except the one for the given name, if present) with the addition of the given name/Value pair.
func (DictEntryTuple) Without ¶
func (t DictEntryTuple) Without(name string) Tuple
Without returns a Tuple with all name/Value pairs in t exception the one of the given name.
type DictEntryTupleExpr ¶
type DictEntryTupleExpr struct { ExprScanner // contains filtered or unexported fields }
DictEntryTupleExpr represents an expr that evaluates to a DictEntryTuple.
func NewDictEntryTupleExpr ¶
func NewDictEntryTupleExpr(scanner parser.Scanner, at, value Expr) DictEntryTupleExpr
NewDictEntryTupleExpr returns a new dictEntryTupleExpr.
func (DictEntryTupleExpr) String ¶
func (e DictEntryTupleExpr) String() string
String returns a string representation of the expression.
type DictEnumerator ¶
type DictEnumerator struct {
// contains filtered or unexported fields
}
func (*DictEnumerator) Current ¶
func (a *DictEnumerator) Current() (key, value Value)
func (*DictEnumerator) MoveNext ¶
func (a *DictEnumerator) MoveNext() bool
type DictExpr ¶
type DictExpr struct { ExprScanner // contains filtered or unexported fields }
DictExpr represents an expression that yields a dict.
type DictPattern ¶ added in v0.3.0
type DictPattern struct {
// contains filtered or unexported fields
}
func NewDictPattern ¶ added in v0.3.0
func NewDictPattern(entries ...DictPatternEntry) DictPattern
func (DictPattern) Bindings ¶ added in v0.71.0
func (p DictPattern) Bindings() []string
func (DictPattern) String ¶ added in v0.3.0
func (p DictPattern) String() string
type DictPatternEntry ¶ added in v0.3.0
type DictPatternEntry struct {
// contains filtered or unexported fields
}
func NewDictPatternEntry ¶ added in v0.3.0
func NewDictPatternEntry(at Expr, pattern FallbackPattern) DictPatternEntry
func (DictPatternEntry) String ¶ added in v0.3.0
func (p DictPatternEntry) String() string
type DotExpr ¶
type DotExpr struct { ExprScanner // contains filtered or unexported fields }
DotExpr returns the tuple or set with a single field replaced by an expression.
type DynIdentExpr ¶ added in v0.153.0
type DynIdentExpr struct {
IdentExpr
}
type DynIdentPattern ¶ added in v0.153.0
type DynIdentPattern string
func (DynIdentPattern) Bindings ¶ added in v0.153.0
func (p DynIdentPattern) Bindings() []string
func (DynIdentPattern) String ¶ added in v0.153.0
func (p DynIdentPattern) String() string
type DynLetExpr ¶ added in v0.155.0
type DynLetExpr struct { ExprScanner // contains filtered or unexported fields }
DynLetExpr implements "let bindings; expr", where bindings must evaluates to a tuple whose attributes are all dynamic names. These names will be bound dynamically for evaluation of expr.
func (*DynLetExpr) Eval ¶ added in v0.155.0
Eval evaluates expr with the contents of bindings bound as dynamic variables.
func (*DynLetExpr) String ¶ added in v0.155.0
func (e *DynLetExpr) String() string
String returns a string representation of the expression.
type EmptySet ¶ added in v0.243.0
type EmptySet struct{}
func (EmptySet) ArrayEnumerator ¶ added in v0.243.0
func (e EmptySet) ArrayEnumerator() ValueEnumerator
func (EmptySet) Enumerator ¶ added in v0.243.0
func (e EmptySet) Enumerator() ValueEnumerator
type Expr ¶
type Expr interface { // All exprs can be serialized to strings with the String() method. fmt.Stringer // Eval evaluates the expr in a given scope. Eval(ctx context.Context, local Scope) (Value, error) // Source returns the Scanner that locates the expression in a source file. Source() parser.Scanner }
Expr represents an arr.ai expression.
func NewAddArrowExpr ¶ added in v0.91.0
NewAddArrowExpr returns a new BinExpr which supports operator `+>`.
func NewAddExpr ¶
NewAddExpr evaluates a + b, given two Numbers.
func NewArrayExpr ¶
NewArrayExpr returns a new Expr that constructs an Array.
func NewArrowExpr ¶
NewArrowExpr returns a new ArrowExpr.
func NewBytesExpr ¶ added in v0.3.0
func NewCallExpr ¶
NewCallExpr evaluates a without b, given a set lhs.
func NewComposeExpr ¶ added in v0.106.0
NewComposeExpr evaluates a <-> b.
func NewConcatExpr ¶
NewConcatExpr evaluates a ++ b.
func NewCondExpr ¶
NewCondExpr returns a new CondExpr.
func NewCondPatternControlVarExpr ¶ added in v0.3.0
func NewCondPatternControlVarExpr(scanner parser.Scanner, controlVar Expr, patternExprs ...PatternExprPair) Expr
NewCondPatternControlVarExpr returns a new CondPatternControlVarExpr.
func NewCountExpr ¶
NewCountExpr evaluates to the number of elements in a.
func NewDArrowExpr ¶ added in v0.33.0
NewDArrowExpr returns a new DArrowExpr.
func NewDictExpr ¶
func NewDictExpr( scanner parser.Scanner, allowDupKeys bool, dictExprAlways bool, entryExprs ...DictEntryTupleExpr, ) (Expr, error)
NewDictExpr returns a new DictExpr from pairs.
func NewDiffExpr ¶
NewDiffExpr evaluates a &~ b.
func NewDivExpr ¶
NewDivExpr evaluates a / b, given two Numbers.
func NewDotExpr ¶
NewDotExpr returns a new DotExpr that fetches the given attr from the lhs, which is expected to be a tuple.
func NewDotIdent ¶ added in v0.50.0
func NewDynLetExpr ¶ added in v0.155.0
NewDynLetExpr returns a new DynLetExpr.
func NewEvalExpr ¶
NewEvalExpr evaluates to *a, given a set lhs.
func NewFunction ¶
NewFunction returns a new function.
func NewIdentExpr ¶
NewIdentExpr returns a new identifier.
func NewIdivExpr ¶
NewIdivExpr evaluates ⎣a / b⎦, given two Numbers.
func NewIfElseExpr ¶
NewIfElseExpr returns a new IfElseExpr. Deprecated: NewIfElseExpr will be removed, it should use NewCondExpr instead.
func NewIntersectExpr ¶
NewIntersectExpr evaluates a <&> b.
func NewJoinCommonExpr ¶ added in v0.106.0
NewJoinCommonExpr evaluates a -&- b.
func NewJoinExistsExpr ¶ added in v0.106.0
NewJoinExistsExpr evaluates a --- b.
func NewJoinExpr ¶
NewJoinExpr evaluates a <&> b.
func NewLeftMatchExpr ¶ added in v0.106.0
NewLeftMatchExpr evaluates a <&- b.
func NewLeftResidueExpr ¶ added in v0.106.0
NewLeftResidueExpr evaluates a <-- b.
func NewMaxExpr ¶
NewMaxExpr evaluates to the max of expr over all elements in a.
func NewMeanExpr ¶
NewMeanExpr evaluates to the mean of expr over all elements in a.
func NewMedianExpr ¶
NewMedianExpr evaluates to the median of expr over all elements in a.
func NewMinExpr ¶
NewMinExpr evaluates to the min of expr over all elements in a.
func NewModExpr ¶
NewModExpr evaluates a % b, given two Numbers.
func NewMulExpr ¶
NewMulExpr evaluates a * b, given two Numbers.
func NewNestExpr ¶
NewNestExpr returns a new NestExpr.
func NewOffsetExpr ¶
NewOffsetExpr returns a new OffsetExpr
func NewOrderByExpr ¶
NewOrderByExpr evaluates a orderby key, given a set lhs, returning an array.
func NewOrderExpr ¶
NewOrderExpr evaluates a order less, given a set lhs, returning an array.
func NewPowExpr ¶
NewPowExpr evaluates a to the power of b, given two Numbers.
func NewPowerSetExpr ¶
NewPowerSetExpr evaluates to ^a.
func NewRankExpr ¶ added in v0.3.0
NewRankExpr evaluates a rank tuplef, given a relation lhs, returning a new relation with each lhs tuple augmented by the tuplef attrs containing the corresponding rank.
func NewRecursionExpr ¶ added in v0.3.0
func NewReduceExpr ¶
func NewReduceExpr(scanner parser.Scanner, a Expr, f *Function, format string, init func(s Set) (interface{}, error), reduce func(acc interface{}, v Value) (interface{}, error), output func(acc interface{}) (Value, error), ) Expr
NewReduceExpr evaluates a reduce f, given a set lhs.
func NewRelationExpr ¶
NewRelationExpr returns a new relation for the given data.
func NewRightMatchExpr ¶ added in v0.106.0
NewRightMatchExpr evaluates a -&> b.
func NewRightResidueExpr ¶ added in v0.106.0
NewRightResidueExpr evaluates a --> b.
func NewSafeTailExpr ¶ added in v0.3.0
func NewSafeTailExpr(scanner parser.Scanner, fallback, base Expr, tailExprs []SafeTailCallback) Expr
func NewSetExpr ¶
NewSetExpr returns a new TupleExpr.
func NewSingleExpr ¶ added in v0.3.0
NewSingleExpr evaluates to the single element in a or fails if a count != 1.
func NewSingleNestExpr ¶ added in v0.122.0
NewSingleNestExpr returns a new SingleNestExpr.
func NewSubExpr ¶
NewSubExpr evaluates a - b, given two Numbers.
func NewSubModExpr ¶
NewSubModExpr evaluates a % b, given two Numbers.
func NewSumExpr ¶
NewSumExpr evaluates to the sum of expr over all elements in a.
func NewSymmDiffExpr ¶
NewSymmDiffExpr evaluates a ~~ b.
func NewTupleExpr ¶
NewTupleExpr returns a new TupleExpr.
func NewTupleExprFromMap ¶
NewTupleExprFromMap returns a new TupleExpr from a map[string]Expr.
func NewTupleMapExpr ¶
NewAngleArrowExpr returns a new AtArrowExpr.
func NewTupleProjectExpr ¶ added in v0.121.0
func NewUnionExpr ¶
NewUnionExpr evaluates a | b.
func NewUnnestExpr ¶
NewUnnestExpr returns a new UnnestExpr.
func NewWhereExpr ¶
NewWhereExpr evaluates a where pred, given a set lhs.
func NewWithExpr ¶
NewWithExpr evaluates a with b, given a set lhs.
type ExprClosure ¶
type ExprClosure struct {
// contains filtered or unexported fields
}
ExprClosure represents the closure of an expression over a scope.
func (ExprClosure) ArrayEnumerator ¶ added in v0.3.0
func (ExprClosure) ArrayEnumerator() ValueEnumerator
func (ExprClosure) CallAll ¶ added in v0.3.0
func (c ExprClosure) CallAll(_ context.Context, arg Value, b SetBuilder) error
func (ExprClosure) Count ¶ added in v0.3.0
func (ExprClosure) Count() int
func (ExprClosure) Enumerator ¶ added in v0.3.0
func (ExprClosure) Enumerator() ValueEnumerator
func (ExprClosure) Equal ¶
func (c ExprClosure) Equal(i interface{}) bool
Equal tests two Values for equality. Any other type returns false.
func (ExprClosure) EqualExprClosure ¶
func (c ExprClosure) EqualExprClosure(d ExprClosure) bool
Equal tests two Values for equality. Any other type returns false.
func (ExprClosure) Export ¶
func (c ExprClosure) Export(ctx context.Context) interface{}
Export exports a ExprClosure.
func (ExprClosure) Format ¶ added in v0.291.0
func (c ExprClosure) Format(f fmt.State, verb rune)
Format formats the expression.
func (ExprClosure) Has ¶ added in v0.3.0
func (ExprClosure) Has(Value) bool
func (ExprClosure) Hash ¶
func (c ExprClosure) Hash(seed uintptr) uintptr
Hash computes a hash for a ExprClosure.
func (ExprClosure) IsTrue ¶
func (c ExprClosure) IsTrue() bool
Bool returns true iff the tuple has attributes.
func (ExprClosure) Kind ¶
func (c ExprClosure) Kind() int
Kind returns a number that is unique for each major kind of Value.
func (ExprClosure) Less ¶
func (c ExprClosure) Less(d Value) bool
Less returns true iff g is not a number or f.number < g.number.
func (ExprClosure) Source ¶
func (c ExprClosure) Source() parser.Scanner
Source returns a scanner locating the ExprClosure's source code.
func (ExprClosure) String ¶
func (c ExprClosure) String() string
String returns a string representation of the expression.
func (ExprClosure) With ¶ added in v0.3.0
func (c ExprClosure) With(Value) Set
func (ExprClosure) Without ¶ added in v0.3.0
func (ExprClosure) Without(Value) Set
type ExprExpr ¶ added in v0.50.0
type ExprExpr struct { ExprScanner Expr }
ExprExpr represents an expression that yields a Literal.
func NewExprExpr ¶ added in v0.50.0
NewExprExpr returns a new ExprExpr from pairs.
type ExprPattern ¶ added in v0.24.0
type ExprPattern struct {
Expr Expr
}
func (ExprPattern) Bindings ¶ added in v0.71.0
func (p ExprPattern) Bindings() []string
func (ExprPattern) String ¶ added in v0.24.0
func (p ExprPattern) String() string
type ExprScanner ¶
ExprScanner represents the source location of an Expr.
func (ExprScanner) Source ¶
func (e ExprScanner) Source() parser.Scanner
Source returns a scanner locating the expression's source code.
type ExprsPattern ¶ added in v0.3.0
type ExprsPattern struct {
// contains filtered or unexported fields
}
func NewExprsPattern ¶ added in v0.3.0
func NewExprsPattern(exprs ...Expr) ExprsPattern
func (ExprsPattern) Bindings ¶ added in v0.71.0
func (p ExprsPattern) Bindings() []string
func (ExprsPattern) String ¶ added in v0.3.0
func (p ExprsPattern) String() string
type ExtraElementPattern ¶ added in v0.3.0
type ExtraElementPattern struct {
// contains filtered or unexported fields
}
func NewExtraElementPattern ¶ added in v0.3.0
func NewExtraElementPattern(ident string) ExtraElementPattern
func (ExtraElementPattern) Bindings ¶ added in v0.71.0
func (p ExtraElementPattern) Bindings() []string
func (ExtraElementPattern) String ¶ added in v0.3.0
func (p ExtraElementPattern) String() string
type FallbackPattern ¶ added in v0.84.0
type FallbackPattern struct {
// contains filtered or unexported fields
}
func NewFallbackPattern ¶ added in v0.84.0
func NewFallbackPattern(pattern Pattern, fallback Expr) FallbackPattern
func (FallbackPattern) String ¶ added in v0.84.0
func (p FallbackPattern) String() string
type Function ¶
type Function struct { ExprScanner // contains filtered or unexported fields }
Function represents a binary relation uniquely mapping inputs to outputs.
func ExprAsFunction ¶
ExprAsFunction returns a function for an expr. If the expr is already a function, returns expr. Otherwise, returns expr wrapper in a function with arg '.'.
func (*Function) EqualFunction ¶
Equal tests two Values for equality. Any other type returns false.
type GenericSet ¶
type GenericSet struct {
// contains filtered or unexported fields
}
GenericSet is a set of Values.
func (GenericSet) ArrayEnumerator ¶
func (s GenericSet) ArrayEnumerator() ValueEnumerator
func (GenericSet) CallAll ¶ added in v0.3.0
func (s GenericSet) CallAll(_ context.Context, arg Value, b SetBuilder) error
func (GenericSet) Count ¶
func (s GenericSet) Count() int
Count returns the number of elements in the genericSet.
func (GenericSet) Enumerator ¶
func (s GenericSet) Enumerator() ValueEnumerator
Enumerator returns an enumerator over the Values in the genericSet.
func (GenericSet) Equal ¶
func (s GenericSet) Equal(v interface{}) bool
Equal tests two Sets for equality. Any other type returns false.
func (GenericSet) Export ¶
func (s GenericSet) Export(ctx context.Context) interface{}
Export exports a genericSet as an array of exported Values.
func (GenericSet) Format ¶ added in v0.291.0
func (s GenericSet) Format(f fmt.State, verb rune)
Format formats a genericSet.
func (GenericSet) Has ¶
func (s GenericSet) Has(value Value) bool
Has returns true iff the given Value is in the genericSet.
func (GenericSet) Hash ¶
func (s GenericSet) Hash(seed uintptr) uintptr
Hash computes a hash for a genericSet.
func (GenericSet) IsTrue ¶
func (s GenericSet) IsTrue() bool
Bool returns true iff the tuple has attributes.
func (GenericSet) Kind ¶
func (s GenericSet) Kind() int
Kind returns a number that is unique for each major kind of Value.
func (GenericSet) Less ¶
func (s GenericSet) Less(v Value) bool
Less returns true iff v.Kind() < genericSet.Kind() or v is a genericSet and t precedes v in a lexicographical comparison of their sorted values.
func (GenericSet) OrderedValues ¶
func (s GenericSet) OrderedValues() ValueEnumerator
OrderedValues returns Values in a canonical ordering.
func (GenericSet) Source ¶
func (s GenericSet) Source() parser.Scanner
Source returns a scanner locating the GenericSet's source code.
func (GenericSet) String ¶
func (s GenericSet) String() string
String returns a string representation of a genericSet.
func (GenericSet) Where ¶
Where returns a new genericSet with all the Values satisfying predicate p.
func (GenericSet) With ¶
func (s GenericSet) With(v Value) Set
With returns the original genericSet with given value added. Iff the value was already present, the original genericSet is returned.
func (GenericSet) Without ¶
func (s GenericSet) Without(value Value) Set
Without returns the original genericSet without the given value. Iff the value was already absent, the original genericSet is returned.
type GenericTuple ¶
type GenericTuple struct {
// contains filtered or unexported fields
}
GenericTuple is the default implementation of Tuple.
func (*GenericTuple) Canonical ¶
func (t *GenericTuple) Canonical() Tuple
func (*GenericTuple) Count ¶
func (t *GenericTuple) Count() int
Count returns how many attributes are in the Tuple.
func (*GenericTuple) Enumerator ¶
func (t *GenericTuple) Enumerator() AttrEnumerator
Enumerator returns an enumerator over the Values in the GenericTuple.
func (*GenericTuple) Equal ¶
func (t *GenericTuple) Equal(v interface{}) bool
Equal tests two Tuples for equality. Any other type returns false.
func (*GenericTuple) Export ¶
func (t *GenericTuple) Export(ctx context.Context) interface{}
Export exports a Tuple.
func (*GenericTuple) Format ¶ added in v0.291.0
func (t *GenericTuple) Format(f fmt.State, verb rune)
Format formats a GenericTuple.
func (*GenericTuple) Get ¶
func (t *GenericTuple) Get(name string) (Value, bool)
Get returns the Value associated with a name, and true iff it was found.
func (*GenericTuple) HasName ¶
func (t *GenericTuple) HasName(name string) bool
HasName returns true iff the Tuple has an attribute with the given name.
func (*GenericTuple) Hash ¶
func (t *GenericTuple) Hash(seed uintptr) uintptr
Hash computes a hash for a GenericTuple.
func (*GenericTuple) IsTrue ¶
func (t *GenericTuple) IsTrue() bool
Bool returns true iff the tuple has attributes.
func (*GenericTuple) Kind ¶
func (t *GenericTuple) Kind() int
Kind returns a number that is unique for each major kind of Value.
func (*GenericTuple) Less ¶
func (t *GenericTuple) Less(v Value) bool
Less returns true iff v is not a number or tuple, or v is a tuple and t precedes v in a lexicographical comparison of their name/value pairs.
func (*GenericTuple) MustGet ¶
func (t *GenericTuple) MustGet(name string) Value
MustGet returns e.Get(name) or panics if an error occurs.
func (*GenericTuple) Names ¶
func (t *GenericTuple) Names() Names
Names returns the attribute names.
func (*GenericTuple) Negate ¶
func (t *GenericTuple) Negate() Value
Negate returns x if t matches {(negateTag): x} else {(negateTag): t}.
func (*GenericTuple) Project ¶
func (t *GenericTuple) Project(names Names) Tuple
Project returns a tuple with the given names from this tuple, or nil if any name wasn't found.
func (*GenericTuple) Source ¶
func (t *GenericTuple) Source() parser.Scanner
Source returns a scanner locating the GenericTuple's source code.
func (*GenericTuple) String ¶
func (t *GenericTuple) String() string
String returns a string representation of a Tuple.
func (*GenericTuple) With ¶
func (t *GenericTuple) With(name string, value Value) Tuple
With returns a Tuple with all name/Value pairs in t (except the one for the given name, if present) with the addition of the given name/Value pair.
func (*GenericTuple) Without ¶
func (t *GenericTuple) Without(name string) Tuple
Without returns a Tuple with all name/Value pairs in t exception the one of the given name.
type GenericTupleEnumerator ¶
type GenericTupleEnumerator struct {
// contains filtered or unexported fields
}
GenericTupleEnumerator represents an enumerator over a GenericTuple.
func (*GenericTupleEnumerator) Current ¶
func (e *GenericTupleEnumerator) Current() (string, Value)
Current returns the enumerator's current Value.
func (*GenericTupleEnumerator) MoveNext ¶
func (e *GenericTupleEnumerator) MoveNext() bool
MoveNext moves the enumerator to the next Value.
type IdentExpr ¶
type IdentExpr struct { ExprScanner // contains filtered or unexported fields }
IdentExpr returns the variable referenced by ident.
type IdentPattern ¶
type IdentPattern string
func (IdentPattern) Bindings ¶ added in v0.71.0
func (p IdentPattern) Bindings() []string
func (IdentPattern) Ident ¶ added in v0.153.0
func (p IdentPattern) Ident() string
func (IdentPattern) String ¶
func (p IdentPattern) String() string
type IfElseExpr ¶
type IfElseExpr struct { ExprScanner // contains filtered or unexported fields }
IfElseExpr returns the tuple applied to a function. Deprecated: IfElseExpr will be removed, it should use CondExpr instead.
func (*IfElseExpr) String ¶
func (e *IfElseExpr) String() string
String returns a string representation of the expression.
type LiteralExpr ¶ added in v0.50.0
type LiteralExpr struct { ExprScanner // contains filtered or unexported fields }
LiteralExpr represents an expression that yields a Literal.
func NewLiteralExpr ¶ added in v0.50.0
func NewLiteralExpr(scanner parser.Scanner, literal Value) LiteralExpr
NewLiteralExpr returns a new LiteralExpr from pairs.
func (LiteralExpr) Literal ¶ added in v0.50.0
func (e LiteralExpr) Literal() Value
func (LiteralExpr) String ¶ added in v0.50.0
func (e LiteralExpr) String() string
String returns a string representation of the expression.
type LiteralMatcher ¶
type LiteralMatcher struct {
// contains filtered or unexported fields
}
func Lit ¶
func Lit(value Value) LiteralMatcher
func (LiteralMatcher) Match ¶
func (m LiteralMatcher) Match(v Value) bool
type MissingAttrError ¶ added in v0.3.0
type MissingAttrError struct {
// contains filtered or unexported fields
}
func (MissingAttrError) Error ¶ added in v0.3.0
func (m MissingAttrError) Error() string
type Names ¶
Names represents a set of names.
func CombineNames ¶
CombineNames returns names from a and b according to the given mask.
func RelationAttrs ¶
RelationAttrs returns the set of names for a relation type, or an error if the set isn't a regular relation.
func (Names) Enumerator ¶
func (n Names) Enumerator() *NamesEnumerator
Enumerator returns an enumerator over a set of names.
func (Names) IsSubsetOf ¶
IsSubsetOf returns true if `n“ is a subset of `o`.
func (Names) OrderedNames ¶
Names returns a sorted slice of the names in the set.
type NamesEnumerator ¶
type NamesEnumerator struct {
// contains filtered or unexported fields
}
NamesEnumerator represents an enumerator over a set of names.
func (*NamesEnumerator) Current ¶
func (e *NamesEnumerator) Current() string
Current returns the enumerator's current Value.
func (*NamesEnumerator) MoveNext ¶
func (e *NamesEnumerator) MoveNext() bool
MoveNext moves the enumerator to the next Value.
type NamesSlice ¶ added in v0.258.0
type NamesSlice []string
func (NamesSlice) EqualNamesSlice ¶ added in v0.258.0
func (n NamesSlice) EqualNamesSlice(n2 NamesSlice) bool
func (NamesSlice) EqualTupleAttrs ¶ added in v0.258.0
func (n NamesSlice) EqualTupleAttrs(t Tuple) bool
func (NamesSlice) GetSorted ¶ added in v0.263.0
func (n NamesSlice) GetSorted() NamesSlice
func (NamesSlice) LessNamesSlice ¶ added in v0.258.0
func (n NamesSlice) LessNamesSlice(n2 NamesSlice) bool
func (NamesSlice) String ¶ added in v0.258.0
func (n NamesSlice) String() string
type NativeFunction ¶
type NativeFunction struct {
// contains filtered or unexported fields
}
NativeFunction represents a binary relation uniquely mapping inputs to outputs.
func (*NativeFunction) ArrayEnumerator ¶ added in v0.3.0
func (*NativeFunction) ArrayEnumerator() ValueEnumerator
func (*NativeFunction) CallAll ¶ added in v0.3.0
func (f *NativeFunction) CallAll(ctx context.Context, arg Value, b SetBuilder) error
Call calls the NativeFunction with the given parameter.
func (*NativeFunction) Count ¶ added in v0.3.0
func (*NativeFunction) Count() int
func (*NativeFunction) Enumerator ¶ added in v0.3.0
func (*NativeFunction) Enumerator() ValueEnumerator
func (*NativeFunction) Equal ¶
func (f *NativeFunction) Equal(i interface{}) bool
Equal tests two Values for equality. Any other type returns false.
func (*NativeFunction) Export ¶
func (f *NativeFunction) Export(_ context.Context) interface{}
Export exports a NativeFunction.
func (*NativeFunction) Format ¶ added in v0.291.0
func (f *NativeFunction) Format(s fmt.State, verb rune)
Format formats the expression.
func (*NativeFunction) Has ¶ added in v0.3.0
func (*NativeFunction) Has(Value) bool
func (*NativeFunction) Hash ¶
func (f *NativeFunction) Hash(seed uintptr) uintptr
Hash computes a hash for a NativeFunction.
func (*NativeFunction) Kind ¶
func (f *NativeFunction) Kind() int
Kind returns a number that is unique for each major kind of Value.
func (*NativeFunction) Less ¶
func (f *NativeFunction) Less(g Value) bool
Less returns true iff g is not a number or f.number < g.number.
func (*NativeFunction) Name ¶
func (f *NativeFunction) Name() string
Name returns a native function's name.
func (*NativeFunction) Negate ¶
func (f *NativeFunction) Negate() Value
Negate returns {(negateTag): f}.
func (*NativeFunction) Source ¶
func (f *NativeFunction) Source() parser.Scanner
Source returns an empty scanner since NativeFunction doesn't have associated source code.
func (*NativeFunction) String ¶
func (f *NativeFunction) String() string
String returns a string representation of the expression.
func (*NativeFunction) With ¶ added in v0.3.0
func (*NativeFunction) With(Value) Set
func (*NativeFunction) Without ¶ added in v0.3.0
func (*NativeFunction) Without(Value) Set
type NestExpr ¶
type NestExpr struct { ExprScanner // contains filtered or unexported fields }
NestExpr returns the relation with names grouped into a nested relation.
type NoReturnError ¶ added in v0.3.0
type NoReturnError struct {
// contains filtered or unexported fields
}
NoReturnError is an error signififying that there was no return value.
func (NoReturnError) Error ¶ added in v0.3.0
func (n NoReturnError) Error() string
type Number ¶
type Number float64
Number is a number.
type OffsetExpr ¶
type OffsetExpr struct { ExprScanner // contains filtered or unexported fields }
OffsetExpr is an expression which offsets the provided array by the provided offset
func (*OffsetExpr) String ¶
func (o *OffsetExpr) String() string
type OrExpr ¶
type OrExpr struct { ExprScanner // contains filtered or unexported fields }
type OrderableSet ¶ added in v0.267.0
type OrderableSet interface { Set OrderedValues() ValueEnumerator }
OrderableSet is a type used to repr GenericSet and UnionSet to avoid duplications.
type Pair ¶
type Pair struct {
// contains filtered or unexported fields
}
Pair represents a pair of values.
type Pattern ¶
type Pattern interface { // Require a String() method. fmt.Stringer // Bind binds pattern with value and add the binding pair to scope Bind(ctx context.Context, scope Scope, value Value) (context.Context, Scope, error) // Bindings returns all the names a pattern expects to bind Bindings() []string }
Pattern can be inside an Expr, Expr can be a Pattern.
func NewExprPattern ¶ added in v0.24.0
func NewIdentPattern ¶
type PatternExprPair ¶ added in v0.17.0
type PatternExprPair struct {
// contains filtered or unexported fields
}
PatternExprPair a Pattern/Expr pair
func NewPatternExprPair ¶ added in v0.17.0
func NewPatternExprPair(pattern Pattern, expr Expr) PatternExprPair
NewPatternExprPair returns a new PatternExprPair.
func (PatternExprPair) Bind ¶ added in v0.17.0
func (p PatternExprPair) Bind( ctx context.Context, local Scope, value Value, ) (context.Context, Scope, error)
Bind implements Pattern.Bind.
func (PatternExprPair) Expr ¶ added in v0.163.0
func (p PatternExprPair) Expr() Expr
Expr returns the PatternExprPair's Expr.
func (PatternExprPair) Pattern ¶ added in v0.163.0
func (p PatternExprPair) Pattern() Pattern
Pattern returns the PatternExprPair's Pattern.
func (PatternExprPair) String ¶ added in v0.17.0
func (p PatternExprPair) String() string
String returns a string representation of a PatternPair.
type RecursionExpr ¶ added in v0.3.0
type RecursionExpr struct { ExprScanner // contains filtered or unexported fields }
func (RecursionExpr) String ¶ added in v0.3.0
func (r RecursionExpr) String() string
type ReduceExpr ¶
type ReduceExpr struct { ExprScanner // contains filtered or unexported fields }
ReduceExpr represents a range of operators.
func (*ReduceExpr) String ¶
func (e *ReduceExpr) String() string
String returns a string representation of the expression.
type Relation ¶
type Relation struct {
// contains filtered or unexported fields
}
Relation is a Set that only contains Tuples, all of which map the same keys.
func (Relation) ArrayEnumerator ¶ added in v0.258.0
func (r Relation) ArrayEnumerator() ValueEnumerator
func (Relation) AttrsName ¶ added in v0.258.0
func (r Relation) AttrsName() NamesSlice
func (Relation) Enumerator ¶ added in v0.258.0
func (r Relation) Enumerator() ValueEnumerator
func (Relation) EqualRelation ¶ added in v0.258.0
func (Relation) Join ¶ added in v0.258.0
func (r Relation) Join(r2 Relation, keys, leftOutput, rightOutput NamesSlice) Set
Join joins two relation based on the keys and defined outputs. Only does natural Join.
func (Relation) OrderedValues ¶ added in v0.283.0
func (r Relation) OrderedValues() ValueEnumerator
func (Relation) OrderedValuesEnumerator ¶ added in v0.258.0
func (r Relation) OrderedValuesEnumerator(names NamesSlice) *RelationValuesEnumerator
type RelationValuesEnumerator ¶ added in v0.258.0
type RelationValuesEnumerator struct {
// contains filtered or unexported fields
}
RelationValuesEnumerator enumerates the values as Values.
func (*RelationValuesEnumerator) Next ¶ added in v0.258.0
func (e *RelationValuesEnumerator) Next() bool
func (*RelationValuesEnumerator) Values ¶ added in v0.258.0
func (e *RelationValuesEnumerator) Values() Values
type SafeTailCallback ¶ added in v0.3.0
type SafeTailExpr ¶ added in v0.3.0
type SafeTailExpr struct { ExprScanner // contains filtered or unexported fields }
func (*SafeTailExpr) String ¶ added in v0.3.0
func (s *SafeTailExpr) String() string
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope represents an expression scope.
var EmptyScope Scope
EmptyScope is the scope with no variables.
func (Scope) Enumerator ¶
func (s Scope) Enumerator() *ScopeEnumerator
Enumerator returns an enumerator over the Values in the Scope.
func (Scope) MatchedUpdate ¶
MatchedUpdate merges s and t. New keys are added as Update, but existing keys fail unless the new value equals the existing value
func (Scope) MatchedWith ¶
MatchedWith returns a new scope. New keys are added as With, but existing keys fail unless the new value equals the existing value
func (Scope) OrderedNames ¶
OrderedNames returns the names of this tuple in sorted order.
func (Scope) Update ¶
s.Update(t) merges s and t, choosing t's binding in the event of a name clash. It's like calling s.With(t0).With(t1).With(t2)... for each element of t
type ScopeEnumerator ¶
type ScopeEnumerator struct {
// contains filtered or unexported fields
}
ScopeEnumerator represents an enumerator over a Scope.
func (ScopeEnumerator) Current ¶
func (e ScopeEnumerator) Current() (string, Expr)
Current returns the enumerator's current Value.
func (ScopeEnumerator) MoveNext ¶
func (e ScopeEnumerator) MoveNext() bool
MoveNext moves the enumerator to the next Value.
type SeqArrowExpr ¶ added in v0.36.0
type SeqArrowExpr struct { ExprScanner // contains filtered or unexported fields }
SeqArrowExpr returns the tuple applied to a function.
func (*SeqArrowExpr) String ¶ added in v0.36.0
func (e *SeqArrowExpr) String() string
String returns a string representation of the expression.
type Set ¶
type Set interface { Value // Access Count() int Has(Value) bool Enumerator() ValueEnumerator ArrayEnumerator() ValueEnumerator // iterates in ascending order. // Transform With(Value) Set Without(Value) Set Map(func(Value) (Value, error)) (Set, error) Where(func(Value) (bool, error)) (Set, error) CallAll(context.Context, Value, SetBuilder) error // contains filtered or unexported methods }
Set represents a Set of Values.
func CanonicalSet ¶
func Concatenate ¶
Concatenate is equivalent to a <&> (b => . + {.@ + a count}). Naturally, this assumes that every element in b is a tuple with at least an '@' attribute, which is numeric.
E.g., [1, 2] + [3] = [1, 2, 3]; "hell" + "o" = "hello"
func Difference ¶
Difference returns every Value from the first Set that is not in the second.
func GenericJoin ¶
func GenericJoin( a, b Set, getKey func(value Value) Value, join func(key Value, a, b Set) Set, ) Set
GenericJoin joins two sets using a key and a joiner
func MustNewDict ¶ added in v0.179.0
func MustNewDict(allowDupKeys bool, entries ...DictEntryTuple) Set
MustNewDict constructs a dict as a relation {|@, @value|...}, or panics if construction fails.
func MustNewSet ¶ added in v0.179.0
MustNewSet constructs a genericSet from a set of Values, or panics if construction fails.
func NConcatenate ¶
NConcatenate applies concatenate to one or more sets.
func NIntersect ¶
NIntersect returns every Value from a that is also in all bs.
func NewDict ¶
func NewDict(allowDupKeys bool, entries ...DictEntryTuple) (Set, error)
NewDict constructs a dict as a relation {|@, @value|...}.
func NewOffsetArray ¶
NewOffsetArray constructs an offset array as a relation.
func NewOffsetBytes ¶
NewOffsetBytes constructs an offset byte array as a relation.
func NewOffsetString ¶
NewOffsetString constructs an offset string as a relation.
func NewSetFrom ¶
NewSetFrom constructs a genericSet from interfaces.
func SingleAttrNest ¶ added in v0.122.0
SingleAttrNest nests a single attribute as a set.
func SymmetricDifference ¶
SymmetricDifference returns Values in either Set, but not in both.
type SetBuilder ¶ added in v0.238.0
type SetBuilder struct {
// contains filtered or unexported fields
}
func NewSetBuilder ¶ added in v0.238.0
func NewSetBuilder() SetBuilder
func (*SetBuilder) Add ¶ added in v0.238.0
func (b *SetBuilder) Add(v Value)
func (*SetBuilder) Finish ¶ added in v0.238.0
func (b *SetBuilder) Finish() (Set, error)
type SetExpr ¶
type SetExpr struct { ExprScanner // contains filtered or unexported fields }
SetExpr returns the tuple or set with a single field replaced by an expression.
type SetPattern ¶ added in v0.24.0
type SetPattern struct {
// contains filtered or unexported fields
}
func NewSetPattern ¶ added in v0.24.0
func NewSetPattern(patterns ...Pattern) SetPattern
func (SetPattern) Bindings ¶ added in v0.71.0
func (p SetPattern) Bindings() []string
func (SetPattern) String ¶ added in v0.24.0
func (p SetPattern) String() string
type SingleNestExpr ¶ added in v0.122.0
type SingleNestExpr struct { ExprScanner // contains filtered or unexported fields }
SingleNestExpr returns the relation with names grouped into a nested relation.
func (*SingleNestExpr) Eval ¶ added in v0.122.0
Eval returns e.lhs with e.attrs grouped under e.attr.
func (*SingleNestExpr) String ¶ added in v0.122.0
func (e *SingleNestExpr) String() string
String returns a string representation of the expression.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a set of Values.
func (String) ArrayEnumerator ¶
func (s String) ArrayEnumerator() ValueEnumerator
func (String) Enumerator ¶
func (s String) Enumerator() ValueEnumerator
Enumerator returns an enumerator over the Values in the String.
func (String) EqualString ¶ added in v0.238.0
func (String) Less ¶
Less returns true iff v is not a number or tuple, or v is a tuple and t precedes v in a lexicographical comparison of their name/value pairs.
type StringCharTuple ¶
type StringCharTuple struct {
// contains filtered or unexported fields
}
StringCharTuple represents a tuple of the form (@: at, @char: char).
func NewStringCharTuple ¶
func NewStringCharTuple(at int, char rune) StringCharTuple
NewStringCharTuple constructs a CharTuple.
func (StringCharTuple) Count ¶
func (t StringCharTuple) Count() int
Count returns how many attributes are in the Tuple.
func (StringCharTuple) Enumerator ¶
func (t StringCharTuple) Enumerator() AttrEnumerator
Enumerator returns an enumerator over the Values in the CharTuple.
func (StringCharTuple) Equal ¶
func (t StringCharTuple) Equal(v interface{}) bool
Equal tests two Tuples for equality. Any other type returns false.
func (StringCharTuple) Export ¶
func (t StringCharTuple) Export(_ context.Context) interface{}
Export exports a Tuple.
func (StringCharTuple) Format ¶ added in v0.291.0
func (t StringCharTuple) Format(f fmt.State, verb rune)
Format formats a StringCharTuple.
func (StringCharTuple) Get ¶
func (t StringCharTuple) Get(name string) (Value, bool)
Get returns the Value associated with a name, and true iff it was found.
func (StringCharTuple) HasName ¶
func (t StringCharTuple) HasName(name string) bool
HasName returns true iff the Tuple has an attribute with the given name.
func (StringCharTuple) Hash ¶
func (t StringCharTuple) Hash(seed uintptr) uintptr
Hash computes a hash for a CharTuple.
func (StringCharTuple) IsTrue ¶
func (t StringCharTuple) IsTrue() bool
Bool returns true iff the tuple has attributes.
func (StringCharTuple) Kind ¶
func (t StringCharTuple) Kind() int
Kind returns a number that is unique for each major kind of Value.
func (StringCharTuple) Less ¶
func (t StringCharTuple) Less(v Value) bool
Less returns true iff v is not a number or tuple, or v is a tuple and t precedes v in a lexicographical comparison of their name/value pairs.
func (StringCharTuple) MustGet ¶
func (t StringCharTuple) MustGet(name string) Value
MustGet returns e.Get(name) or panics if an error occurs.
func (StringCharTuple) Names ¶
func (t StringCharTuple) Names() Names
Names returns the attribute names.
func (StringCharTuple) Negate ¶
func (t StringCharTuple) Negate() Value
func (StringCharTuple) Project ¶
func (t StringCharTuple) Project(names Names) Tuple
Project returns a tuple with the given names from this tuple, or nil if any name wasn't found.
func (StringCharTuple) Source ¶
func (t StringCharTuple) Source() parser.Scanner
Source returns a scanner locating the StringCharTuple's source code.
func (StringCharTuple) String ¶
func (t StringCharTuple) String() string
String returns a string representation of a StringCharTuple.
func (StringCharTuple) With ¶
func (t StringCharTuple) With(name string, value Value) Tuple
With returns a Tuple with all name/Value pairs in t (except the one for the given name, if present) with the addition of the given name/Value pair.
func (StringCharTuple) Without ¶
func (t StringCharTuple) Without(name string) Tuple
Without returns a Tuple with all name/Value pairs in t exception the one of the given name.
type StringCharTupleExpr ¶
type StringCharTupleExpr struct { ExprScanner // contains filtered or unexported fields }
StringCharTupleExpr represents an expr that evaluates to a StringCharTuple.
func NewStringCharTupleExpr ¶
func NewStringCharTupleExpr(scanner parser.Scanner, at, char Expr) StringCharTupleExpr
NewStringCharTupleExpr returns a new dictEntryTupleExpr.
func (StringCharTupleExpr) String ¶
func (e StringCharTupleExpr) String() string
String returns a string representation of the expression.
type TrueSet ¶ added in v0.252.0
type TrueSet struct{}
TrueSet is a special set that represents True/{()}.
func (TrueSet) ArrayEnumerator ¶ added in v0.252.0
func (t TrueSet) ArrayEnumerator() ValueEnumerator
func (TrueSet) Enumerator ¶ added in v0.252.0
func (TrueSet) Enumerator() ValueEnumerator
type Tuple ¶
type Tuple interface { Value // Access Count() int Get(name string) (Value, bool) MustGet(name string) Value HasName(name string) bool Names() Names Enumerator() AttrEnumerator // Transform With(name string, value Value) Tuple Without(name string) Tuple Map(func(Value) (Value, error)) (Tuple, error) Project(names Names) Tuple }
Tuple is a mapping from names to Values.
var ( // EmptyTuple is the tuple with no attributes. EmptyTuple Tuple = &GenericTuple{} )
func ASTBranchToValue ¶
func Merge ¶
Merge returns the merger of a and b, if possible or nil otherwise. Success requires that common names map to equal values.
func MergeLeftToRight ¶
MergeLeftToRight returns the merger of a and b. Key from tuples to the right override tuples to the left.
func MergeTuples ¶ added in v0.274.0
MergeTuples takes two tuples and performs a deep merge
func NewTupleFromMap ¶
NewTupleFromMap constructs a Tuple from a map of strings to Go values.
func TupleProjectAllBut ¶ added in v0.106.0
TupleProjectAllBut returns the projection of t over all of its attributes except those specified in names.
type TupleBuilder ¶
type TupleBuilder frozen.MapBuilder
func (*TupleBuilder) Finish ¶
func (b *TupleBuilder) Finish() Tuple
func (*TupleBuilder) Put ¶
func (b *TupleBuilder) Put(name string, value Value)
type TupleExpr ¶
type TupleExpr struct { ExprScanner // contains filtered or unexported fields }
TupleExpr returns a set from a slice of Exprs.
type TupleMapExpr ¶
type TupleMapExpr struct { ExprScanner // contains filtered or unexported fields }
TupleMapExpr returns the tuple applied to a function.
func (*TupleMapExpr) String ¶
func (e *TupleMapExpr) String() string
String returns a string representation of the expression.
type TupleMatcher ¶
type TupleMatcher struct {
// contains filtered or unexported fields
}
func NewTupleMatcher ¶
func NewTupleMatcher(attrs map[string]Matcher, rest Matcher) TupleMatcher
func (TupleMatcher) Match ¶
func (m TupleMatcher) Match(v Value) bool
type TuplePattern ¶
type TuplePattern struct {
// contains filtered or unexported fields
}
func NewTuplePattern ¶
func NewTuplePattern(attrs ...TuplePatternAttr) (TuplePattern, error)
func (TuplePattern) Bindings ¶ added in v0.71.0
func (p TuplePattern) Bindings() []string
func (TuplePattern) String ¶
func (p TuplePattern) String() string
type TuplePatternAttr ¶ added in v0.3.0
type TuplePatternAttr struct {
// contains filtered or unexported fields
}
func NewTuplePatternAttr ¶ added in v0.3.0
func NewTuplePatternAttr(name string, pattern FallbackPattern) TuplePatternAttr
func (*TuplePatternAttr) IsWildcard ¶ added in v0.3.0
func (a *TuplePatternAttr) IsWildcard() bool
func (TuplePatternAttr) String ¶ added in v0.3.0
func (a TuplePatternAttr) String() string
type TupleProjectExpr ¶ added in v0.121.0
type TupleProjectExpr struct { ExprScanner // contains filtered or unexported fields }
func (*TupleProjectExpr) String ¶ added in v0.121.0
func (tp *TupleProjectExpr) String() string
type UnaryExpr ¶
type UnaryExpr struct { ExprScanner // contains filtered or unexported fields }
UnaryExpr represents a range of operators.
type UnionSet ¶ added in v0.248.0
type UnionSet struct {
// contains filtered or unexported fields
}
func (UnionSet) ArrayEnumerator ¶ added in v0.248.0
func (u UnionSet) ArrayEnumerator() ValueEnumerator
func (UnionSet) Enumerator ¶ added in v0.248.0
func (u UnionSet) Enumerator() ValueEnumerator
func (UnionSet) OrderedValues ¶ added in v0.248.0
func (u UnionSet) OrderedValues() ValueEnumerator
type UnnestExpr ¶
type UnnestExpr struct { ExprScanner // contains filtered or unexported fields }
UnnestExpr returns the relation with names grouped into a nested relation.
func (*UnnestExpr) AttrToUnnest ¶
func (e *UnnestExpr) AttrToUnnest() string
AttrToUnnest returns the attr name to unnest.
func (*UnnestExpr) String ¶
func (e *UnnestExpr) String() string
String returns a string representation of the expression.
type Value ¶
type Value interface { fmt.Formatter frozen.Key // Values are Exprs. Expr // Kind returns a number that is unique for each major kind of Value. Kind() int // IsTrue returns true iff the Value is non-zero or non-empty. IsTrue() bool // Less return true iff the Value is less than v. Number < Tuple < Set. Less(v Value) bool // Negate returns the negation of the Value. // - For numbers, this is the arithmetic negation of the value. // - For the tuple {(negateTag): x}, it returns x. // - For all other values, x, it returns {(negateTag): x}. Negate() Value // Export converts the Value to a natural Go value. Export(context.Context) interface{} // contains filtered or unexported methods }
Value represents any arr.ai value.
func ASTLeafToValue ¶
func ASTNodeToValue ¶
func NewExprClosure ¶
NewExprClosure returns a new ExprClosure.
func NewNativeFunction ¶
func NewNativeFunction(name string, fn NativeFnBody) Value
NewNativeFunction returns a new function.
func NewNativeLambda ¶
func NewNativeLambda(fn NativeFnBody) Value
NewNativeLambda returns a nameless function.
func SetCall ¶ added in v0.3.0
SetCall is a convenience wrapper to call a set and return the result or an error if there isn't exactly one result.
func UnmarshalFromJSON ¶
UnmarshalFromJSON unmarshals the given value from JSON interpreting escaped sets ({"{||}": s}) accordingly.
func ValueEnumeratorToSlice ¶
func ValueEnumeratorToSlice(e ValueEnumerator) []Value
ValueEnumeratorToSlice transcribes its Values in a slice.
type ValueEnumerator ¶
ValueEnumerator enumerates Values.
func OrderedValueEnumerator ¶
func OrderedValueEnumerator(e ValueEnumerator, less Less) ValueEnumerator
Source Files ¶
- astnode_value.go
- constants.go
- expr.go
- expr_array.go
- expr_array_item_entry.go
- expr_arrow.go
- expr_binary.go
- expr_bytes.go
- expr_cond.go
- expr_cond_pattern_control_var.go
- expr_darrow.go
- expr_dict.go
- expr_dot.go
- expr_dynlet.go
- expr_expr.go
- expr_ident.go
- expr_if_else.go
- expr_literal.go
- expr_logical.go
- expr_nary.go
- expr_nest.go
- expr_offset.go
- expr_recursion.go
- expr_reduce.go
- expr_reduce_median.go
- expr_rel.go
- expr_safe_tail.go
- expr_seqmap.go
- expr_set.go
- expr_single_nest.go
- expr_string_char_entry.go
- expr_tuple.go
- expr_tuple_dict_entry.go
- expr_tuple_project.go
- expr_tuplemap.go
- expr_unary.go
- expr_unnest.go
- json.go
- logging.go
- match.go
- names.go
- ops_rel.go
- ops_set.go
- ops_set_rank.go
- ops_tuple.go
- pattern.go
- pattern_array.go
- pattern_dict.go
- pattern_expr.go
- pattern_expr_pair.go
- pattern_extra_element.go
- pattern_fallback.go
- pattern_ident.go
- pattern_set.go
- pattern_tuple.go
- scope.go
- test_helpers.go
- value.go
- value_kind.go
- value_number.go
- value_repr.go
- value_set_array.go
- value_set_builder.go
- value_set_bytes.go
- value_set_closure.go
- value_set_dict.go
- value_set_eclosure.go
- value_set_empty.go
- value_set_func.go
- value_set_generic.go
- value_set_native_expr_func.go
- value_set_native_func.go
- value_set_rel.go
- value_set_relpos.go
- value_set_str.go
- value_set_true.go
- value_set_union.go
- value_tuple.go
- value_tuple_array_item.go
- value_tuple_bytes_byte.go
- value_tuple_dict_entry.go
- value_tuple_str_char.go
- value_util.go
- value_values.go