Documentation ¶
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 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 GetStringValue(expr Expr) (string, bool)
- func MakeBinValExpr(op string, eval valueEval) func(scanner parser.Scanner, a, b Expr) Expr
- func MarshalToJSON(value Value) []byte
- func Repr(v Value) string
- 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
- type AndExpr
- type Array
- func (a Array) ArrayEnumerator() (OffsetValueEnumerator, bool)
- func (a Array) Bind(scope Scope, value Value) (Scope, error)
- func (a Array) CallAll(arg Value) Set
- func (a Array) Count() int
- func (a Array) Enumerator() ValueEnumerator
- func (a Array) Equal(v interface{}) bool
- func (a Array) Eval(_ Scope) (Value, error)
- func (a Array) Export() interface{}
- 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) Set
- 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) Set
- func (a Array) With(value Value) Set
- func (a Array) Without(value Value) Set
- type ArrayExpr
- type ArrayItemTuple
- func (t ArrayItemTuple) Attributes() map[string]Value
- func (t ArrayItemTuple) Count() int
- func (t ArrayItemTuple) Enumerator() AttrEnumerator
- func (t ArrayItemTuple) Equal(v interface{}) bool
- func (t ArrayItemTuple) Eval(local Scope) (Value, error)
- func (t ArrayItemTuple) Export() interface{}
- 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) Tuple
- 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 func(Value) Value) Attr
- func NewStringAttr(name string, value []rune) Attr
- func NewTupleAttr(name string, attrs ...Attr) Attr
- type AttrEnumerator
- type AttrExpr
- type BinExpr
- type BindMatcher
- type Bytes
- func (b Bytes) ArrayEnumerator() (OffsetValueEnumerator, bool)
- func (b Bytes) Bytes() []byte
- func (b Bytes) CallAll(arg Value) Set
- func (b Bytes) Count() int
- func (b Bytes) Enumerator() ValueEnumerator
- func (b Bytes) Equal(v interface{}) bool
- func (b Bytes) Eval(_ Scope) (Value, error)
- func (b Bytes) Export() interface{}
- 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) Set
- 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) Set
- func (b Bytes) With(value Value) Set
- func (b Bytes) Without(value Value) Set
- type BytesByteTuple
- func (t BytesByteTuple) Attributes() map[string]Value
- func (t BytesByteTuple) Count() int
- func (t BytesByteTuple) Enumerator() AttrEnumerator
- func (t BytesByteTuple) Equal(v interface{}) bool
- func (t BytesByteTuple) Eval(local Scope) (Value, error)
- func (t BytesByteTuple) Export() interface{}
- 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) Tuple
- 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() (OffsetValueEnumerator, bool)
- func (c Closure) CallAll(arg Value) Set
- 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(local Scope) (Value, error)
- func (c Closure) Export() interface{}
- 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(Value) Value) Set
- func (c Closure) Negate() Value
- func (c Closure) Source() parser.Scanner
- func (c Closure) String() string
- func (c Closure) Where(f func(Value) bool) Set
- func (c Closure) With(v Value) Set
- func (c Closure) Without(v Value) Set
- type CombineOp
- type CompareExpr
- type CompareFunc
- type CondControlVarExpr
- type CondExpr
- type CondPatternControlVarExpr
- type ContextErr
- type DArrowExpr
- type Dict
- func (d Dict) ArrayEnumerator() (OffsetValueEnumerator, bool)
- func (d Dict) CallAll(arg Value) Set
- 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(local Scope) (Value, error)
- func (d Dict) Export() interface{}
- 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(m func(Value) Value) Set
- 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(pred func(Value) bool) Set
- func (d Dict) With(v Value) Set
- func (d Dict) Without(v Value) Set
- type DictEntryTuple
- func (t DictEntryTuple) Attributes() map[string]Value
- func (t DictEntryTuple) Count() int
- func (t DictEntryTuple) Enumerator() AttrEnumerator
- func (t DictEntryTuple) Equal(v interface{}) bool
- func (t DictEntryTuple) Eval(local Scope) (Value, error)
- func (t DictEntryTuple) Export() interface{}
- 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) Tuple
- 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 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 NewConcatExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewCondControlVarExpr(scanner parser.Scanner, controlVar Expr, dictExpr Expr) Expr
- func NewCondExpr(scanner parser.Scanner, dict Expr) Expr
- func NewCondPatternControlVarExpr(scanner parser.Scanner, controlVar Expr, patternExprs ...PatternExpr) Expr
- func NewCountExpr(scanner parser.Scanner, a Expr) Expr
- func NewDictExpr(scanner parser.Scanner, allowDupKeys bool, dictExprAlways bool, ...) Expr
- 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 NewEvalExpr(scanner parser.Scanner, a Expr) Expr
- func NewFunction(scanner parser.Scanner, arg Pattern, body Expr) Expr
- func NewIdivExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewIfElseExpr(scanner parser.Scanner, ifTrue, cond, ifFalse Expr) Expr
- func NewIndexedSequenceMapExpr(scanner parser.Scanner, lhs, rhs Expr) Expr
- func NewIntersectExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewJoinExpr(scanner parser.Scanner, a, b Expr) Expr
- func NewMapExpr(scanner parser.Scanner, lhs Expr, fn 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, 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 Pattern, 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 NewSafeTailExpr(scanner parser.Scanner, fallback, base Expr, tailExprs []SafeTailCallback) Expr
- func NewSequenceMapExpr(scanner parser.Scanner, lhs Expr, fn Expr) Expr
- func NewSetExpr(scanner parser.Scanner, elements ...Expr) Expr
- func NewSingleExpr(scanner parser.Scanner, a Expr) 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 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() (OffsetValueEnumerator, bool)
- func (c ExprClosure) CallAll(arg Value) Set
- 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(_ Scope) (Value, error)
- func (c ExprClosure) Export() interface{}
- 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) Set
- func (c ExprClosure) Negate() Value
- func (c ExprClosure) Source() parser.Scanner
- func (c ExprClosure) String() string
- func (ExprClosure) Where(func(Value) bool) Set
- func (c ExprClosure) With(Value) Set
- func (ExprClosure) Without(Value) Set
- type ExprScanner
- type ExprsPattern
- type ExtraElementPattern
- type FuncMatcher
- type Function
- type GenericSet
- func (s GenericSet) Any() Value
- func (s GenericSet) ArrayEnumerator() (OffsetValueEnumerator, bool)
- func (s GenericSet) CallAll(arg Value) Set
- func (s GenericSet) Count() int
- func (s GenericSet) Enumerator() ValueEnumerator
- func (s GenericSet) Equal(v interface{}) bool
- func (s GenericSet) Eval(local Scope) (Value, error)
- func (s GenericSet) Export() interface{}
- 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) Set
- func (s GenericSet) Negate() Value
- func (s GenericSet) OrderedValues() []Value
- func (s GenericSet) Source() parser.Scanner
- func (s GenericSet) String() string
- func (s GenericSet) Where(p func(v Value) bool) Set
- func (s GenericSet) With(value Value) Set
- func (s GenericSet) Without(value Value) Set
- type GenericTuple
- func (t *GenericTuple) Attributes() map[string]Value
- 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(local Scope) (Value, error)
- func (t *GenericTuple) Export() interface{}
- 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) Tuple
- 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 IdentLookupFailed
- type IdentPattern
- type IfElseExpr
- type IndexedSequenceMapExpr
- type LHSExpr
- type Less
- type Let
- type LiteralMatcher
- type MatchAll
- type MatchFirst
- type MatchInt
- type MatchNum
- 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 NativeFunction
- func (*NativeFunction) ArrayEnumerator() (OffsetValueEnumerator, bool)
- func (f *NativeFunction) CallAll(arg Value) Set
- func (*NativeFunction) Count() int
- func (*NativeFunction) Enumerator() ValueEnumerator
- func (f *NativeFunction) Equal(i interface{}) bool
- func (f *NativeFunction) Eval(local Scope) (Value, error)
- func (f *NativeFunction) Export() interface{}
- func (f *NativeFunction) Fn() func(Value) Value
- 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) Set
- func (f *NativeFunction) Name() string
- func (f *NativeFunction) Negate() Value
- func (f *NativeFunction) Source() parser.Scanner
- func (f *NativeFunction) String() string
- func (*NativeFunction) Where(func(Value) bool) Set
- func (*NativeFunction) With(Value) Set
- func (*NativeFunction) Without(Value) Set
- type NestExpr
- type NoReturnError
- type Number
- func (n Number) Bind(scope Scope, value Value) (Scope, error)
- func (n Number) Equal(v interface{}) bool
- func (n Number) Eval(_ Scope) (Value, error)
- func (n Number) Export() interface{}
- func (n Number) Float64() float64
- 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 OffsetValueEnumerator
- type OrExpr
- type Pair
- type Pattern
- type PatternExpr
- type RecursionExpr
- type ReduceExpr
- type Relation
- type SafeTailCallback
- type SafeTailExpr
- type Scope
- func (s Scope) Count() int
- func (s Scope) Enumerator() *ScopeEnumerator
- func (s Scope) Eval(local Scope) (Value, error)
- func (s Scope) Get(name string) (Expr, bool)
- func (s Scope) MatchedUpdate(t Scope) Scope
- func (s Scope) MatchedWith(name string, expr Expr) Scope
- 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 SequenceMapExpr
- 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 Join(a, b Set) 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, 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
- 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
- func NewSetFrom(intfs ...interface{}) (Set, error)
- func NewString(s []rune) Set
- func PowerSet(s Set) Set
- func Rank(s Set, rankerf func(v Tuple) Tuple) (Set, error)
- func Reduce(a Set, getKey func(value Value) Value, reduce func(key Value, tuples Set) Set) Set
- func SymmetricDifference(a, b Set) Set
- func Union(a, b Set) Set
- func Unnest(a Set, attr string) Set
- type SetExpr
- type SetMatcher
- type String
- func (s String) ArrayEnumerator() (OffsetValueEnumerator, bool)
- func (s String) CallAll(arg Value) Set
- func (s String) Count() int
- func (s String) Enumerator() ValueEnumerator
- func (s String) Equal(v interface{}) bool
- func (s String) Eval(_ Scope) (Value, error)
- func (s String) Export() interface{}
- 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) Set
- 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) Set
- func (s String) With(value Value) Set
- func (s String) Without(value Value) Set
- type StringCharTuple
- func (t StringCharTuple) Attributes() map[string]Value
- func (t StringCharTuple) Count() int
- func (t StringCharTuple) Enumerator() AttrEnumerator
- func (t StringCharTuple) Equal(v interface{}) bool
- func (t StringCharTuple) Eval(local Scope) (Value, error)
- func (t StringCharTuple) Export() interface{}
- 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) Tuple
- 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 Tuple
- type TupleBuilder
- type TupleExpr
- type TupleMapExpr
- type TupleMatcher
- type TuplePattern
- type TuplePatternAttr
- type UnaryExpr
- type UnnestExpr
- type Value
- func ASTLeafToValue(l ast.Leaf) Value
- func ASTNodeToValue(n ast.Node) Value
- func Call(a, b Value, local Scope) (Value, error)
- func EvalExpr(expr Expr, local Scope) (_ Value, err error)
- func NewClosure(scope Scope, f *Function) Value
- func NewExprClosure(scope Scope, e Expr) Value
- func NewNativeFunction(name string, fn func(Value) Value) Value
- func NewNativeLambda(fn func(Value) Value) 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 SafeSetCall(s Set, arg Value) (Value, error)
- func SetAny(s Set) Value
- func SetCall(s Set, arg Value) Value
- func UnmarshalFromJSON(data []byte) (Value, error)
- func ValueEnumeratorToSlice(e ValueEnumerator) []Value
- type ValueEnumerator
- type ValueList
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 ¶
var ( None = Set(GenericSet{frozen.Set{}}) False = None True = None.With(EmptyTuple) )
genericSet equivalents for Boolean true and false
var DotIdent = IdentExpr{ExprScanner: ExprScanner{Src: *parser.NewScanner(".")}, /* contains filtered or unexported fields */}
DotIdent represents the special identifier '.'.
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 AssertExprEvalsToType ¶
AssertExprEvalsToType asserts that the exprs evaluate to the same value.
func AssertExprPanics ¶
AssertExprPanics asserts that the expr panics when evaluates.
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 GetStringValue ¶
GetStringValue returns the string value for expr or false if not a string.
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 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.
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() (OffsetValueEnumerator, bool)
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.
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) Attributes ¶
func (t ArrayItemTuple) Attributes() map[string]Value
Attributes returns attributes as a map.
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) Eval ¶
func (t ArrayItemTuple) Eval(local Scope) (Value, error)
Eval returns the tuple.
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) Eval ¶
func (e ArrayItemTupleExpr) Eval(local Scope) (_ Value, err error)
Eval returns the subject.
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 ...Pattern) ArrayPattern
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 ¶
NewNativeFunction returns a new function.
func NewStringAttr ¶
NewStringAttr return an attr with a string value.
func NewTupleAttr ¶
NewTupleAttr return an attr with a new tuple 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 MustNewAttrExpr ¶
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 BindMatcher ¶
type BindMatcher struct {
// contains filtered or unexported fields
}
func Bind ¶
func Bind(target interface{}) BindMatcher
func (BindMatcher) Match ¶
func (m BindMatcher) Match(v Value) bool
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
Bytes is a set of Values.
func (Bytes) ArrayEnumerator ¶
func (b Bytes) ArrayEnumerator() (OffsetValueEnumerator, bool)
func (Bytes) Enumerator ¶
func (b Bytes) Enumerator() ValueEnumerator
Enumerator returns an enumerator over the Values in the Bytes.
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) Attributes ¶
func (t BytesByteTuple) Attributes() map[string]Value
Attributes returns attributes as a map.
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) Eval ¶
func (t BytesByteTuple) Eval(local Scope) (Value, error)
Eval returns the tuple.
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 Tuple.
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 (Closure) ArrayEnumerator ¶ added in v0.3.0
func (c Closure) ArrayEnumerator() (OffsetValueEnumerator, bool)
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) Eval ¶
func (e CompareExpr) Eval(local Scope) (Value, error)
Eval returns the subject
func (CompareExpr) String ¶
func (e CompareExpr) String() string
String returns a string representation of the expression.
type CompareFunc ¶
type CondControlVarExpr ¶
type CondControlVarExpr struct { ExprScanner // contains filtered or unexported fields }
CondControlVarExpr returns the tuple applied to a function, the expression looks like: let a = 1 + 1; a cond (1 : 2 + 1, 2 : 5, *: 10) let a = 1 + 1; let b = a cond (1 : 2 + 1, 2 : 5, *: 10); b
func (CondControlVarExpr) Eval ¶
func (e CondControlVarExpr) Eval(local Scope) (Value, error)
Eval returns the value of valid condition and whose value equals to the control var value, or the value of default condition.
func (CondControlVarExpr) String ¶
func (e CondControlVarExpr) String() string
String returns a string representation of the expression.
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) Eval ¶ added in v0.3.0
func (expr CondPatternControlVarExpr) Eval(local Scope) (Value, error)
Eval evaluates to find the first valid condition and return its value.
func (CondPatternControlVarExpr) String ¶ added in v0.3.0
func (expr CondPatternControlVarExpr) String() string
type ContextErr ¶ added in v0.4.0
type ContextErr struct {
// contains filtered or unexported fields
}
func (ContextErr) Error ¶ added in v0.4.0
func (c ContextErr) Error() string
func (ContextErr) GetLastScope ¶ added in v0.4.0
func (c ContextErr) GetLastScope() Scope
GetLastScope gets the scope nearest to the error
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) Eval ¶
func (e *DArrowExpr) Eval(local Scope) (_ Value, err error)
Eval returns the lhs transformed elementwise by fn.
func (*DArrowExpr) Fn ¶
func (e *DArrowExpr) Fn() *Function
Fn returns the function to be applied to the LHS.
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() (OffsetValueEnumerator, bool)
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) Attributes ¶
func (t DictEntryTuple) Attributes() map[string]Value
Attributes returns attributes as a map.
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) Eval ¶
func (t DictEntryTuple) Eval(local Scope) (Value, error)
Eval returns the tuple.
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 Tuple.
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) Eval ¶
func (e DictEntryTupleExpr) Eval(local Scope) (Value, error)
Eval returns the subject
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) Bind ¶ added in v0.3.0
func (p DictPattern) Bind(local Scope, value Value) (Scope, error)
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, value Pattern) 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 Expr ¶
type Expr interface { // Require a String() method. fmt.Stringer // Eval evaluates the expr in a given scope. Eval(local Scope) (Value, error) Source() parser.Scanner }
Expr represents an arr.ai expression.
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 NewConcatExpr ¶
NewConcatExpr evaluates a ++ b.
func NewCondControlVarExpr ¶
NewCondControlVarExpr returns a new CondControlVarExpr.
func NewCondExpr ¶
NewCondExpr returns a new CondExpr.
func NewCondPatternControlVarExpr ¶ added in v0.3.0
func NewCondPatternControlVarExpr(scanner parser.Scanner, controlVar Expr, patternExprs ...PatternExpr) Expr
NewCondPatternControlVarExpr returns a new CondPatternControlVarExpr.
func NewCountExpr ¶
NewCountExpr evaluates to the number of elements in a.
func NewDictExpr ¶
func NewDictExpr(scanner parser.Scanner, allowDupKeys bool, dictExprAlways bool, entryExprs ...DictEntryTupleExpr) Expr
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 NewEvalExpr ¶
NewEvalExpr evaluates to *a, given a set lhs.
func NewFunction ¶
NewFunction returns a new function.
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 NewJoinExpr ¶
NewJoinExpr evaluates a <&> b.
func NewMapExpr ¶
NewDArrowExpr returns a new DArrowExpr.
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 NewSafeTailExpr ¶ added in v0.3.0
func NewSafeTailExpr(scanner parser.Scanner, fallback, base Expr, tailExprs []SafeTailCallback) Expr
func NewSequenceMapExpr ¶
NewAngleArrowExpr returns a new AtArrowExpr.
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 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 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() (OffsetValueEnumerator, bool)
func (ExprClosure) CallAll ¶ added in v0.3.0
func (c ExprClosure) CallAll(arg Value) Set
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) 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 ExprScanner ¶
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) Bind ¶ added in v0.3.0
func (ep ExprsPattern) Bind(scope Scope, value Value) (Scope, error)
func (ExprsPattern) String ¶ added in v0.3.0
func (ep 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) Bind ¶ added in v0.3.0
func (p ExtraElementPattern) Bind(scope Scope, value Value) (Scope, error)
func (ExtraElementPattern) String ¶ added in v0.3.0
func (p ExtraElementPattern) String() string
type FuncMatcher ¶
type FuncMatcher struct {
// contains filtered or unexported fields
}
func MatchFunc ¶
func MatchFunc(tuples [][2]Matcher, rest Matcher) FuncMatcher
func (FuncMatcher) Match ¶
func (m FuncMatcher) Match(v Value) bool
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() (OffsetValueEnumerator, bool)
func (GenericSet) CallAll ¶ added in v0.3.0
func (s GenericSet) CallAll(arg Value) Set
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() interface{}
Export exports a genericSet as an array of exported Values.
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() []Value
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 ¶
func (s GenericSet) Where(p func(v Value) bool) Set
Where returns a new genericSet with all the Values satisfying predicate p.
func (GenericSet) With ¶
func (s GenericSet) With(value 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) Attributes ¶
func (t *GenericTuple) Attributes() map[string]Value
Attributes returns attributes as a map.
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) Eval ¶
func (t *GenericTuple) Eval(local Scope) (Value, error)
Eval returns the tuple.
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.
func NewIdentExpr ¶
NewIdentExpr returns a new identifier.
type IdentLookupFailed ¶
type IdentLookupFailed struct {
// contains filtered or unexported fields
}
IdentLookupFailed represents failure to lookup a scope variable.
func (IdentLookupFailed) Error ¶
func (e IdentLookupFailed) Error() string
type IdentPattern ¶
type IdentPattern struct {
// contains filtered or unexported fields
}
func NewIdentPattern ¶
func NewIdentPattern(ident string) IdentPattern
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) Cond ¶
func (e *IfElseExpr) Cond() Expr
Cond returns the condition of the IfElseExpr.
func (*IfElseExpr) Eval ¶
func (e *IfElseExpr) Eval(local Scope) (Value, error)
Eval returns the ifTrue
func (*IfElseExpr) String ¶
func (e *IfElseExpr) String() string
String returns a string representation of the expression.
type IndexedSequenceMapExpr ¶
type IndexedSequenceMapExpr struct { ExprScanner // contains filtered or unexported fields }
func (*IndexedSequenceMapExpr) Eval ¶
func (is *IndexedSequenceMapExpr) Eval(local Scope) (Value, error)
func (*IndexedSequenceMapExpr) String ¶
func (is *IndexedSequenceMapExpr) String() string
String returns a string representation of the expression.
type LHSExpr ¶
type LHSExpr interface {
LHS() Expr
}
LHSExpr represents any Expr that has a LHS component.
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 MatchFirst ¶
type MatchFirst []Matcher
func (MatchFirst) Match ¶
func (m MatchFirst) 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 false 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 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() (OffsetValueEnumerator, bool)
func (*NativeFunction) CallAll ¶ added in v0.3.0
func (f *NativeFunction) CallAll(arg Value) Set
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) Eval ¶
func (f *NativeFunction) Eval(local Scope) (Value, error)
Eval returns the Value
func (*NativeFunction) Export ¶
func (f *NativeFunction) Export() interface{}
Export exports a NativeFunction.
func (*NativeFunction) Fn ¶
func (f *NativeFunction) Fn() func(Value) Value
Fn returns a native function's implementation.
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.
func (*NestExpr) AttrsToNest ¶
AttrsToNest returns the attrs from the LHS to be nested.
func (*NestExpr) NestedAttr ¶
NestedAttr returns the attr name for the nested relations.
type NoReturnError ¶ added in v0.3.0
type NoReturnError struct {
// contains filtered or unexported fields
}
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 OffsetValueEnumerator ¶
type OffsetValueEnumerator interface { ValueEnumerator Offset() int }
type OrExpr ¶
type OrExpr struct { ExprScanner // contains filtered or unexported fields }
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(scope Scope, value Value) (Scope, error) }
Pattern can be inside an Expr, Expr can be a Pattern.
type PatternExpr ¶ added in v0.3.0
type PatternExpr struct {
// contains filtered or unexported fields
}
func NewPatternExpr ¶ added in v0.3.0
func NewPatternExpr(pattern Pattern, expr Expr) PatternExpr
NewPatternExpr returns a new PatternExpr.
func (PatternExpr) Bind ¶ added in v0.3.0
func (pt PatternExpr) Bind(local Scope, value Value) (Scope, error)
func (PatternExpr) String ¶ added in v0.3.0
func (pt PatternExpr) 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) Eval ¶
func (e *ReduceExpr) Eval(local Scope) (_ Value, err error)
Eval returns the subject
func (*ReduceExpr) String ¶
func (e *ReduceExpr) String() string
String returns a string representation of the expression.
type Relation ¶
type Relation Set
Relation is a Set that only contains Tuples, all of which map the same keys.
type SafeTailExpr ¶ added in v0.3.0
type SafeTailExpr struct { ExprScanner // contains filtered or unexported fields }
func (*SafeTailExpr) Eval ¶ added in v0.3.0
func (s *SafeTailExpr) Eval(local Scope) (value Value, err error)
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 SequenceMapExpr ¶
type SequenceMapExpr struct { ExprScanner // contains filtered or unexported fields }
SequenceMapExpr returns the tuple applied to a function.
func (*SequenceMapExpr) Eval ¶
func (e *SequenceMapExpr) Eval(local Scope) (_ Value, err error)
Eval returns the lhs
func (*SequenceMapExpr) Fn ¶
func (e *SequenceMapExpr) Fn() *Function
Fn returns the function to be applied to the LHS.
func (*SequenceMapExpr) LHS ¶
func (e *SequenceMapExpr) LHS() Expr
LHS returns the LHS of the AtArrowExpr.
func (*SequenceMapExpr) String ¶
func (e *SequenceMapExpr) String() string
String returns a string representation of the expression.
type Set ¶
type Set interface { Value // Access Count() int Has(Value) bool Enumerator() ValueEnumerator // Transform With(Value) Set Without(Value) Set Map(func(Value) Value) Set Where(func(Value) bool) Set CallAll(Value) Set ArrayEnumerator() (OffsetValueEnumerator, bool) }
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 Join ¶
Join returns the relation 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…
func NIntersect ¶
func NewDict ¶
func NewDict(allowDupKeys bool, entries ...DictEntryTuple) Set
NewDict constructs a dict as a relation {|@, @value|...}.
func NewOffsetArray ¶
NewArray constructs an array as a relation.
func NewOffsetBytes ¶
NewBytes constructs an array as a relation.
func NewOffsetString ¶
NewString constructs an array as a relation.
func NewSetFrom ¶
NewSetFrom constructs a genericSet from interfaces.
func SymmetricDifference ¶
SymmetricDifference returns Values in either Set, but not in both.
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 SetMatcher ¶
type SetMatcher struct {
// contains filtered or unexported fields
}
func NewSetMatcher ¶
func NewSetMatcher(elem Matcher) SetMatcher
func (SetMatcher) Match ¶
func (m SetMatcher) Match(v Value) bool
type String ¶
type String struct {
// contains filtered or unexported fields
}
String is a set of Values.
func (String) ArrayEnumerator ¶
func (s String) ArrayEnumerator() (OffsetValueEnumerator, bool)
func (String) Enumerator ¶
func (s String) Enumerator() ValueEnumerator
Enumerator returns an enumerator over the Values in the String.
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) Attributes ¶
func (t StringCharTuple) Attributes() map[string]Value
Attributes returns attributes as a map.
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) Eval ¶
func (t StringCharTuple) Eval(local Scope) (Value, error)
Eval returns the tuple.
func (StringCharTuple) Export ¶
func (t StringCharTuple) Export() interface{}
Export exports a Tuple.
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 Tuple.
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) Eval ¶
func (e StringCharTupleExpr) Eval(local Scope) (_ Value, err error)
Eval returns the subject
func (StringCharTupleExpr) String ¶
func (e StringCharTupleExpr) String() string
String returns a string representation of the expression.
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) Tuple 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 NewTupleFromMap ¶
NewTupleFromMap constructs a Tuple from a map of strings to Go values.
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) Eval ¶
func (e *TupleMapExpr) Eval(local Scope) (_ Value, err error)
Eval returns the lhs
func (*TupleMapExpr) Fn ¶
func (e *TupleMapExpr) Fn() *Function
Fn returns the function to be applied to the LHS.
func (*TupleMapExpr) LHS ¶
func (e *TupleMapExpr) LHS() Expr
LHS returns the LHS of the AtArrowExpr.
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
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 Pattern) 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 UnaryExpr ¶
type UnaryExpr struct { ExprScanner // contains filtered or unexported fields }
UnaryExpr represents a range of operators.
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) Eval ¶
func (e *UnnestExpr) Eval(local Scope) (Value, error)
Eval returns e.lhs with e.attrs grouped under e.attr.
func (*UnnestExpr) String ¶
func (e *UnnestExpr) String() string
String returns a string representation of the expression.
type Value ¶
type Value interface { frozen.Key // Values are Exprs. Expr // Kind returns a number that is unique for each major kind of Value. Kind() int // Bool 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() interface{} }
Value represents any arr.ai value.
func ASTLeafToValue ¶
func ASTNodeToValue ¶
func NewClosure ¶
NewFunction returns a new function.
func NewExprClosure ¶
NewFunction returns a new function.
func NewNativeFunction ¶
NewNativeFunction returns a new function.
func NewNativeLambda ¶
NewNativeLambda returns a nameless function.
func SetCall ¶ added in v0.3.0
SetCall does a CallAll to a Set and panics when there's less or more than 1 value.
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
- expr.go
- expr_array.go
- expr_array_item_entry.go
- expr_arrow.go
- expr_binary.go
- expr_bytes.go
- expr_cond.go
- expr_cond_control_var.go
- expr_cond_pattern_control_var.go
- expr_darrow.go
- expr_dict.go
- expr_dot.go
- expr_ident.go
- expr_if_else.go
- expr_indexed_seqmap.go
- expr_logical.go
- expr_nary.go
- expr_nest.go
- expr_offset.go
- expr_pattern.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_string_char_entry.go
- expr_tuple.go
- expr_tuple_dict_entry.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
- scope.go
- test_helpers.go
- value.go
- value_kind.go
- value_number.go
- value_repr.go
- value_set_array.go
- value_set_bytes.go
- value_set_closure.go
- value_set_dict.go
- value_set_eclosure.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_str.go
- value_tuple.go
- value_tuple_array_item.go
- value_tuple_bytes_byte.go
- value_tuple_dict_entry.go
- value_tuple_str_char.go