Involved Source Files Comparison semantics ported from the Rust cypher crate's value.rs: the
three-valued Compare/Equal used by =, <, >, IN and friends; the Kleene
combinators behind AND/OR; and the genuinely total OrderCmp for ORDER BY. Group keys: a canonical byte encoding of a value for DISTINCT / grouping
/ dedup map keys, port of the Rust GroupKey enum (Go maps can't key on
slice-bearing structs, so the projection is a byte string instead of a
hashable enum). Encounter order is preserved by the callers' side slice. Package value holds the GQL engine's runtime values -- what the executor
produces and expressions evaluate to. Distinct from the engine's columnar
chickpeas.Value (a 4-kind stored scalar): a runtime value can also be a
list, map, path, temporal, or a bound node/rel handle. Port of the Rust
cypher crate's Value<'g>; Go strings are immutable shared references, so
the 'g borrow lifetime disappears.
MapEntry is one key/value pair of a map value, in insertion order.KeystringValValue
func Value.AsMap() ([]MapEntry, bool)
func Map(entries []MapEntry) Value
TemporalKind says which temporal a KindTemporal value is. All are epoch
milliseconds (UTC) under the hood; the kind only affects display.
Date is midnight UTC of the day.
func Value.AsTemporal() (millis int64, k TemporalKind, ok bool)
func Temporal(millis int64, k TemporalKind) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.ISOString(millis int64, kind TemporalKind) string
const Date
const DateTime
const LocalDateTime
Value is one runtime value. The zero Value is Null. Scalars store their
payload inline (num holds the int64 bits, float bits, bool, node id, rel
position, or temporal millis); strings ride in str; lists, maps, paths,
and durations share the ext pointer. AsBool returns the boolean payload; ok is false for other kinds. AsDuration returns the duration's components; ok is false for other kinds. AsFloat returns the numeric payload as a float, coercing an integer; ok
is false for non-numeric kinds. AsInt returns the integer payload; ok is false for other kinds. AsList returns the list elements; ok is false for other kinds. AsMap returns the map entries in insertion order; ok is false for other
kinds. AsNode returns the bound node id; ok is false for other kinds. AsPath returns the path's node sequence and relationship positions; ok is
false for other kinds. AsRel returns the bound relationship's CSR position; ok is false for
other kinds. AsStr returns the string payload; ok is false for other kinds. AsTemporal returns the temporal's epoch millis and kind; ok is false for
other kinds. IsNull reports whether the value is Null. IsTruthy is the truthiness WHERE and the boolean operators use: only
Bool(true) is true; Null and non-booleans are not-true. Kind reports the value's discriminant.
func Bool(b bool) Value
func Duration(months, days, millis int64) Value
func Float(f float64) Value
func Int(i int64) Value
func KleeneAnd(l, lknown, r, rknown bool) Value
func KleeneOr(l, lknown, r, rknown bool) Value
func List(vs []Value) Value
func Map(entries []MapEntry) Value
func Node(id chickpeas.NodeID) Value
func Null() Value
func NumericTwin(v Value) (Value, bool)
func Path(nodes []chickpeas.NodeID, rels []uint32) Value
func Rel(pos uint32) Value
func Str(s string) Value
func Temporal(millis int64, k TemporalKind) Value
func Value.AsList() ([]Value, bool)
func github.com/freeeve/gochickpeas/gql.Row.Get(name string) (Value, bool)
func github.com/freeeve/gochickpeas/gql.Row.GetAt(i int) (Value, bool)
func github.com/freeeve/gochickpeas/gql.Row.Values() []Value
func github.com/freeeve/gochickpeas/gql/internal/compile.ConstValue(ctx *eval.Ctx, e ast.Expr, slots map[string]int, g *chickpeas.Snapshot) (Value, bool)
func github.com/freeeve/gochickpeas/gql/internal/compile.(*Compiled).Eval(ctx *eval.Ctx, row []Value, slots map[string]int) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.ApplyFunc(op eval.FuncOp, argv []Value) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.Arith(op ast.BinOp, l, r Value) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.CmpBool(l, r Value, f func(int) bool) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.Concat(l, r Value) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.Eval(ctx *eval.Ctx, expr ast.Expr, row []Value, slots map[string]int) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.LitValue(ctx *eval.Ctx, l ast.Literal) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.StrPred(op ast.BinOp, l, r Value) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.(*Ctx).NamedValue(name string) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.(*Ctx).ParamValue(slot uint32) Value
func github.com/freeeve/gochickpeas/gql/internal/exec.Execute(ctx *eval.Ctx, p *plan.Plan) ([][]Value, error)
func github.com/freeeve/gochickpeas/gql/internal/exec.RowEval.Eval(ctx *eval.Ctx, row []Value, slots map[string]int) Value
func github.com/freeeve/gochickpeas/gql/internal/graph.Graph.NodeProp(node chickpeas.NodeID, key string) (Value, bool)
func github.com/freeeve/gochickpeas/gql/internal/graph.Graph.RelProp(pos uint32, key string) (Value, bool)
func github.com/freeeve/gochickpeas/gql/internal/graph.(*SnapshotGraph).NodeProp(node chickpeas.NodeID, key string) (Value, bool)
func github.com/freeeve/gochickpeas/gql/internal/graph.(*SnapshotGraph).RelProp(pos uint32, key string) (Value, bool)
func github.com/freeeve/gochickpeas/gql/internal/semantics.AutoParameterize(q *ast.Query) []Value
func github.com/freeeve/gochickpeas/gql/internal/semantics.LitValue(l ast.Literal) Value
func AppendKey(b []byte, v Value) []byte
func Compare(a, b Value) (int, bool)
func Equal(a, b Value) bool
func Identical(a, b Value) bool
func Key(v Value) string
func List(vs []Value) Value
func NumericTwin(v Value) (Value, bool)
func OrderCmp(a, b Value) int
func OrderNumF64(v Value) float64
func SameBacking(a, b Value) bool
func ThreeValued(v Value) (truth, known bool)
func github.com/freeeve/gochickpeas/gql.RunUncachedWithParams(g *chickpeas.Snapshot, query string, params map[string]Value) (*gql.Rows, error)
func github.com/freeeve/gochickpeas/gql.RunWithParams(g *chickpeas.Snapshot, query string, params map[string]Value) (*gql.Rows, error)
func github.com/freeeve/gochickpeas/gql.(*PlanCache).RunWithParams(g *chickpeas.Snapshot, query string, params map[string]Value) (*gql.Rows, error)
func github.com/freeeve/gochickpeas/gql.(*Prepared).Execute(g *chickpeas.Snapshot, params map[string]Value) (*gql.Rows, error)
func github.com/freeeve/gochickpeas/gql/internal/compile.HoistConstIn(ctx *eval.Ctx, c *compile.Compiled, isConst func(int) bool, sample []Value, slots map[string]int) *compile.Compiled
func github.com/freeeve/gochickpeas/gql/internal/compile.(*Compiled).Eval(ctx *eval.Ctx, row []Value, slots map[string]int) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.ApplyFunc(op eval.FuncOp, argv []Value) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.Arith(op ast.BinOp, l, r Value) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.CmpBool(l, r Value, f func(int) bool) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.Concat(l, r Value) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.Eval(ctx *eval.Ctx, expr ast.Expr, row []Value, slots map[string]int) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.StrPred(op ast.BinOp, l, r Value) Value
func github.com/freeeve/gochickpeas/gql/internal/eval.SubqueryCount(ctx *eval.Ctx, pattern *ast.Pattern, where ast.Expr, outerRow []Value, outerSlots map[string]int, stopAtFirst bool) int
func github.com/freeeve/gochickpeas/gql/internal/eval.SubqueryGroupCount(ctx *eval.Ctx, pattern *ast.Pattern, where ast.Expr, outerRow []Value, outerSlots map[string]int, anchorVar, groupVar string) map[graph.NodeID]int
func github.com/freeeve/gochickpeas/gql/internal/exec.RowEval.Eval(ctx *eval.Ctx, row []Value, slots map[string]int) Value
func github.com/freeeve/gochickpeas/gql/internal/graph.Graph.NodePropEq(node chickpeas.NodeID, key string, v Value) bool
func github.com/freeeve/gochickpeas/gql/internal/graph.Graph.NodesWithProperty(label, key string, v Value) *nodeset.Set
func github.com/freeeve/gochickpeas/gql/internal/graph.(*SnapshotGraph).NodePropEq(node chickpeas.NodeID, key string, v Value) bool
func github.com/freeeve/gochickpeas/gql/internal/graph.(*SnapshotGraph).NodesWithProperty(label, key string, v Value) *nodeset.Set
func github.com/freeeve/gochickpeas/gql/internal/plan.ResolveCallProc(proc string, args []Value) (plan.CallProc, error)
Package-Level Functions (total 25)
AppendKey appends the canonical byte encoding of v to b: two values
encode identically iff they are one DISTINCT/group key. Floats key by bit
pattern, except an integral float in i64 range canonicalizes to the equal
integer (and -0.0 to 0.0) so grouping agrees with =; NaN keeps its bit
pattern. Map entries encode in key-sorted order, so insertion order does
not split groups.
Bool is a boolean value.
Compare is the three-valued comparison behind =, <>, <, <=, >, >=: ok is
false when either side is Null or the types are not comparable. Numbers
compare across Int/Float by coercing through float64 (including Int/Int,
mirroring the Rust engine exactly -- lossy above 2^53 only).
Duration is a duration by calendar components.
Equal reports three-valued equality collapsed to a boolean: true only
when Compare says equal.
Float is a float value.
Identical is bit-exact value identity, unlike Equal: Null equals Null,
floats compare by bit pattern, and no numeric coercion applies. Used to
decide whether a slot holds the same value on every row of a batch.
Int is an integer value.
Key is the canonical byte encoding of v as a string, for map keys.
KleeneAnd is three-valued AND over ThreeValued operands: false dominates,
else Null if either side is unknown, else true.
KleeneOr is three-valued OR over ThreeValued operands: true dominates,
else Null if either side is unknown, else false.
List is a list value; the slice is taken by reference, not copied.
Map is a map value; entries keep insertion order and are taken by
reference.
Node is a bound graph node.
Null is the absent/unknown value (same as the zero Value).
NumericTwin is the other numeric spelling of v that value.Compare
treats as equal: an integral float's int, an int's float. The property
index keys stored values exactly, while comparison coerces int against
float through float64 -- so an index probe for one spelling must also
probe the twin or rows whose stored type differs from the literal's
are silently lost. Bounded to |v| <= 2^53, where the int<->float
mapping is exact and bijective; beyond it no twin is reported (the
conversion rounds, so a probe would ask about a different number).
OrderCmp is a genuine total order for ORDER BY: values of different type
categories order by a stable type rank (Null last), and same-category
values order naturally. Deliberately NOT Compare (a partial three-valued
relation): NaN is placed after finite numbers via a total float order,
and Temporal is never cross-compared with numbers (which produced an
intransitive cycle in the partial relation); each category is a
self-contained tier.
OrderNumF64 exposes OrderCmp's numeric-tier encoding of an Int/Float
value (NaN for anything else), pairing with TotalOrderF64.
Path is a path value over a node sequence and the relationship positions
between consecutive nodes; both slices are taken by reference.
Rel is a bound relationship by outgoing-CSR position.
SameBacking reports payload identity in O(1): ext-carrying kinds (list,
map, path, duration) compare their shared ext pointer, not content. A
true result guarantees Identical; false says nothing. Used to skip
recomputing derived state (e.g. an IN membership index) when a carried
value is literally the same value as last time.
Str is a string value. The string is referenced, not copied -- a property
read from the immutable snapshot shares the interner's text.
Temporal is an epoch-millis temporal of the given kind.
ThreeValued maps a value to a Kleene truth value for AND/OR: a Bool is
its value, Null is unknown (known=false). A non-boolean operand maps to
false, preserving the engine's leniency (only Bool(true) was ever true).
TotalOrderF64 exposes OrderCmp's numeric-tier total order (IEEE-754
totalOrder) so typed sort-key paths compare through the identical
kernel instead of a re-implementation.
Package-Level Constants (total 15)
Date is a calendar date (midnight UTC).
DateTime is a zoned datetime (treated as UTC).
KindBool is a boolean value.
KindDuration is a duration by calendar components (months, days,
millis); equatable but not totally ordered.
KindFloat is a 64-bit float value.
KindInt is a 64-bit integer value.
KindList is a list value, e.g. the right-hand side of IN [...].
KindMap is a map value with entries in insertion order; equality is
by content regardless of order.
KindNode is a bound graph node -- RETURN n yields this.
KindNull is the absent/unknown value; the zero Value is Null.
KindPath is a path: the node sequence plus the CSR positions of the
relationships between consecutive nodes (len(rels) == len(nodes)-1).
KindRel is a bound relationship, identified by its outgoing-CSR
position (a chickpeas.RelRef.Pos).
KindStr is a string value.
KindTemporal is a date/datetime/localdatetime, epoch-millis-backed.
LocalDateTime is a wall-clock datetime.
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.