pub enum CypherValue {
Show 18 variants
Null,
Bool(bool),
Int(i64),
Float(f64),
Str(String),
List(Vec<CypherValue>),
Map(IndexMap<String, CypherValue>),
Node {
id: i64,
labels: Vec<String>,
properties: IndexMap<String, CypherValue>,
},
Relationship {
id: i64,
start_id: i64,
end_id: i64,
rel_type: String,
properties: IndexMap<String, CypherValue>,
},
Path {
nodes: Vec<CypherValue>,
relationships: Vec<CypherValue>,
},
Date(NaiveDate),
Time(NaiveTime, Option<FixedOffset>),
DateTime(DateTime<FixedOffset>, Option<String>),
LocalDateTime(NaiveDateTime),
Duration(IsoDuration),
Point(PointValue),
Geometry(GeometryValue),
Vector {
coord: VectorCoordKind,
dim: usize,
values: Vec<CypherValue>,
},
}Expand description
The core value type for Relate.
Every value flowing through the query engine is represented as a CypherValue.
This replaces Go’s interface{} with a proper algebraic type.
Variants§
Null
Bool(bool)
Int(i64)
Float(f64)
Str(String)
List(Vec<CypherValue>)
Map(IndexMap<String, CypherValue>)
Node
Relationship
Path
Date(NaiveDate)
Time(NaiveTime, Option<FixedOffset>)
DateTime(DateTime<FixedOffset>, Option<String>)
DateTime with fixed offset and optional IANA timezone name (e.g., “Europe/Stockholm”).
LocalDateTime(NaiveDateTime)
Duration(IsoDuration)
Point(PointValue)
Geometry(GeometryValue)
Vector
CIP-200 VECTOR runtime value: a fixed-length, homogeneously-typed
numeric vector distinct from List. values elements are always
CypherValue::Int when coord.is_integer(), CypherValue::Float
otherwise (never Null or any other variant – enforced by the
vector() constructor, the only way to produce one). dim is
always values.len().
Implementations§
Source§impl CypherValue
impl CypherValue
Sourcepub fn is_temporal(&self) -> bool
pub fn is_temporal(&self) -> bool
True for the five temporal variants (Date, Time, DateTime,
LocalDateTime, Duration) — the one enumeration of the set, beside
Self::is_null and type_name; the renderers that classify
temporals (TOON’s scalars-bare token policy) consult this instead of
re-listing the variants, and a new variant is a compile error here.
Sourcepub fn type_name(&self) -> &'static str
pub fn type_name(&self) -> &'static str
Returns the type name as a string (for the type() function).
Sourcepub fn as_float(&self) -> Option<f64>
pub fn as_float(&self) -> Option<f64>
Attempts to extract a float value, including int-to-float promotion.
Sourcepub fn as_list(&self) -> Option<&[CypherValue]>
pub fn as_list(&self) -> Option<&[CypherValue]>
Attempts to extract a list reference.
Sourcepub fn as_map(&self) -> Option<&IndexMap<String, CypherValue>>
pub fn as_map(&self) -> Option<&IndexMap<String, CypherValue>>
Attempts to extract a map reference.
Sourcepub fn to_bool_3vl(&self) -> Option<bool>
pub fn to_bool_3vl(&self) -> Option<bool>
Returns true if this value is truthy in Cypher’s three-valued logic. Null returns None (unknown), true/false return Some(bool).
Sourcepub fn as_numeric(&self) -> Option<(f64, bool)>
pub fn as_numeric(&self) -> Option<(f64, bool)>
Coerce to a numeric type for arithmetic. Returns (value_as_f64, is_integer).