pub enum Value {
Show 33 variants
Empty,
Null(NullType),
Bool(bool),
SmallInt(i16),
Int(i32),
BigInt(i64),
Float(f32),
Double(f64),
Decimal128(Decimal128Value),
String(CompactString),
FixedString(String),
Blob(Vec<u8>),
Date(DateValue),
Time(TimeValue),
DateTime(DateTimeValue),
Vertex(Box<Vertex>),
Edge(Box<Edge>),
EdgeHeader(Box<EdgeHeader>),
Path(Box<Path>),
List(Box<List>),
Map(Box<HashMap<Value, Value>>),
Set(Box<HashSet<Value>>),
Geography(Geography),
Vector(VectorValue),
DataSet(Box<DataSet>),
Json(Box<Json>),
JsonB(Box<JsonB>),
Uuid(UuidValue),
Interval(IntervalValue),
VertexId(VertexId),
EdgeId(EdgeId),
Struct(Box<StructValue>),
Array(Box<ArrayValue>),
}Expand description
Indicates values that can be stored in node/edge attributes Simplified design following PostgreSQL type system
Variants§
Empty
Null(NullType)
Bool(bool)
SmallInt(i16)
Int(i32)
BigInt(i64)
Float(f32)
Double(f64)
Decimal128(Decimal128Value)
String(CompactString)
FixedString(String)
Fixed-length strings for optimized storage of short strings.
Content is always padded/truncated to the declared length, so the
length is derivable via chars().count().
Blob(Vec<u8>)
Binary data
Date(DateValue)
Time(TimeValue)
DateTime(DateTimeValue)
Vertex(Box<Vertex>)
Edge(Box<Edge>)
EdgeHeader(Box<EdgeHeader>)
Path(Box<Path>)
List(Box<List>)
Map(Box<HashMap<Value, Value>>)
Map with generalized keys: any hashable Value (string keys remain
the common case; float keys use the normalized NaN/±0 hashing).
Set(Box<HashSet<Value>>)
Geography(Geography)
Vector(VectorValue)
DataSet(Box<DataSet>)
Json(Box<Json>)
JSON type (text format)
JsonB(Box<JsonB>)
JSONB type (binary format)
Uuid(UuidValue)
UUID type (16 bytes binary)
Interval(IntervalValue)
Interval type (PostgreSQL compatible)
VertexId(VertexId)
Lightweight vertex ID reference (no heap allocation). Used by expand fast path when only the vertex ID is needed (e.g. count-only aggregation downstream).
EdgeId(EdgeId)
Lightweight edge ID reference (no heap allocation). Used by expand fast path when only the edge ID is needed.
Struct(Box<StructValue>)
STRUCT value: ordered named fields.
Array(Box<ArrayValue>)
ARRAY value: element-homogeneous array.
Implementations§
Source§impl Value
impl Value
Sourcepub fn to_datetime(&self) -> Value
pub fn to_datetime(&self) -> Value
Convert to date and time
Sourcepub fn to_interval(&self) -> Value
pub fn to_interval(&self) -> Value
Convert to interval
Sourcepub fn try_implicit_cast(&self, target_type: &DataType) -> Result<Value, String>
pub fn try_implicit_cast(&self, target_type: &DataType) -> Result<Value, String>
Try to implicitly convert to the specified type.
Sourcepub fn to_smallint(&self) -> Value
pub fn to_smallint(&self) -> Value
Convert to SmallInt (i16)
Sourcepub fn to_float32(&self) -> Value
pub fn to_float32(&self) -> Value
Convert to Float (f32)
Sourcepub fn can_implicitly_cast_to(&self, target_type: &DataType) -> bool
pub fn can_implicitly_cast_to(&self, target_type: &DataType) -> bool
Check whether an implicit conversion is possible.
Sourcepub fn is_valid_number(&self) -> bool
pub fn is_valid_number(&self) -> bool
Check whether the value is a valid number.
Sourcepub fn is_valid_date(&self) -> bool
pub fn is_valid_date(&self) -> bool
Check whether the value is a valid date.
Sourcepub fn is_valid_time(&self) -> bool
pub fn is_valid_time(&self) -> bool
Check whether the value represents a valid time.
Sourcepub fn is_valid_datetime(&self) -> bool
pub fn is_valid_datetime(&self) -> bool
Check whether the value is a valid date and time.
Source§impl Value
impl Value
Sourcepub fn try_cast_to(&self, target: &DataType) -> Result<Value, StorageError>
pub fn try_cast_to(&self, target: &DataType) -> Result<Value, StorageError>
Try to cast this value to the target data type. Returns the converted value on success, or a type_mismatch error. Supports implicit type conversions that are allowed by TypeUtils::can_cast.
Source§impl Value
impl Value
Sourcepub fn string(s: impl AsRef<str>) -> Value
pub fn string(s: impl AsRef<str>) -> Value
Create a string value from a string-like type.
CompactString stores up to 22 bytes inline without heap allocation,
falling back to a heap-allocated String for longer content.
Sourcepub fn string_from_owned(s: String) -> Value
pub fn string_from_owned(s: String) -> Value
Create a string value from an owned String.
Sourcepub fn container_element_type<'a, I>(elements: I) -> DataTypewhere
I: IntoIterator<Item = &'a Value>,
pub fn container_element_type<'a, I>(elements: I) -> DataTypewhere
I: IntoIterator<Item = &'a Value>,
Common type of a container’s elements.
Folds Value::get_type over the element types with the numeric/temporal
promotion hierarchy. Returns DataType::Empty for an empty container
(the “untyped container” marker on the parameterized List/Map/Set
variants).
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if the value is a numeric type
Sourcepub fn is_bad_null(&self) -> bool
pub fn is_bad_null(&self) -> bool
Check if the value is BadNull
Sourcepub fn bool_value(&self) -> Option<bool>
pub fn bool_value(&self) -> Option<bool>
Get Boolean value
Sourcepub fn string_value(&self) -> Option<&str>
pub fn string_value(&self) -> Option<&str>
Get String value
Sourcepub fn as_vector(&self) -> Option<Vec<f32>>
pub fn as_vector(&self) -> Option<Vec<f32>>
Get vector value as Vec
Sourcepub fn as_vector_ref(&self) -> Option<&[f32]>
pub fn as_vector_ref(&self) -> Option<&[f32]>
Get reference to vector data (more efficient than as_vector)
Sourcepub fn sparse_vector(indices: Vec<u32>, values: Vec<f32>) -> Value
pub fn sparse_vector(indices: Vec<u32>, values: Vec<f32>) -> Value
Create a new sparse vector value
Sourcepub fn fixed_string(len: usize, data: String) -> Value
pub fn fixed_string(len: usize, data: String) -> Value
Create fixed-length string value (truncates or space-pads to len)
Sourcepub fn fixed_string_len(&self) -> Option<usize>
pub fn fixed_string_len(&self) -> Option<usize>
Get the length of a fixed-length string
Sourcepub fn hash_value(&self) -> u64
pub fn hash_value(&self) -> u64
Compute the hash of the value
Sourcepub fn estimated_size(&self) -> usize
pub fn estimated_size(&self) -> usize
Estimate the memory usage of the value
Sourcepub fn from_json_value(value: Value) -> Value
pub fn from_json_value(value: Value) -> Value
Create JSON value from serde_json::Value
Source§impl Value
impl Value
Sourcepub fn string_map<K>(map: impl IntoIterator<Item = (K, Value)>) -> Value
pub fn string_map<K>(map: impl IntoIterator<Item = (K, Value)>) -> Value
Create a new Map value from string-keyed entries (the common case).
Sourcepub fn edge_header(header: EdgeHeader) -> Value
pub fn edge_header(header: EdgeHeader) -> Value
Create a new edge header value (wraps in Box)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Value
Source§impl From<&Value> for IntersectKey
impl From<&Value> for IntersectKey
Source§impl From<IntervalValue> for Value
impl From<IntervalValue> for Value
Source§fn from(value: IntervalValue) -> Value
fn from(value: IntervalValue) -> Value
Source§impl From<Value> for JoinKeyValue
impl From<Value> for JoinKeyValue
Source§impl MemoryEstimatable for Value
impl MemoryEstimatable for Value
fn estimate_memory(&self) -> usize
Source§impl Ord for Value
impl Ord for Value
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Value
impl PartialOrd for Value
Source§impl Serialize for Value
impl Serialize for Value
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more