marsdb_query/value.rs
1use marsdb_graph::{Edge, Node, PropertyValue};
2
3use crate::ast::Literal;
4
5/// One element of a `Value::Path` — a path is `node, edge, node, edge,
6/// ..., node`, alternating, as a single `Vec`, not two parallel node/edge
7/// vecs (which would create an unenforced `nodes.len() == edges.len() +
8/// 1` invariant across every place a path gets built or read).
9#[derive(Debug, Clone)]
10pub enum PathElem {
11 Node(Node),
12 Edge(Edge),
13}
14
15#[derive(Debug, Clone)]
16pub enum Value {
17 Node(Node),
18 Edge(Edge),
19 Property(PropertyValue),
20 Literal(Literal),
21 /// A `collect()` result — a query-layer-only concept, not persisted as
22 /// a `PropertyValue` (nothing in the grammar can construct a list
23 /// literal to store as a node/edge property).
24 List(Vec<Value>),
25 /// A named path (`MATCH p = (a)-->(b) RETURN p`) or a `shortestPath()`
26 /// result — see `Binding::Path`'s docs (executor.rs) for how this
27 /// gets assembled during MATCH evaluation.
28 Path(Vec<PathElem>),
29 Null,
30}