pub enum Value {
Show 18 variants
Null,
Bool(bool),
Integer(i64),
Float(f64),
String(String),
Bytes(Vec<u8>),
Array(Vec<Value>),
Object(HashMap<String, Value>),
Uuid(String),
Ulid(String),
DateTime(NdbDateTime),
Duration(NdbDuration),
Decimal(Decimal),
Geometry(Geometry),
Set(Vec<Value>),
Regex(String),
Range {
start: Option<Box<Value>>,
end: Option<Box<Value>>,
inclusive: bool,
},
Record {
table: String,
id: String,
},
}Expand description
A dynamic value that can represent any field type in a document or any parameter in a SQL query.
Serialized with #[serde(untagged)] so that JSON output uses plain
JSON types ("string", 1, true, null, […], {…}) rather than
the externally-tagged form ({"String":"…"}, {"Integer":1}, etc.).
MessagePack (de)serialization is handled by custom ToMessagePack /
FromMessagePack impls and is unaffected by this attribute.
Variants§
Null
SQL NULL / missing value.
Bool(bool)
Boolean.
Integer(i64)
Signed 64-bit integer.
Float(f64)
64-bit floating point.
String(String)
UTF-8 string.
Bytes(Vec<u8>)
Raw bytes (embeddings, serialized blobs).
Array(Vec<Value>)
Ordered array of values.
Object(HashMap<String, Value>)
Nested key-value object.
Uuid(String)
UUID (any version, stored as 36-char hyphenated string).
Ulid(String)
ULID (26-char Crockford Base32).
DateTime(NdbDateTime)
UTC timestamp with microsecond precision.
Duration(NdbDuration)
Duration with microsecond precision (signed).
Decimal(Decimal)
Arbitrary-precision decimal (financial calculations, exact arithmetic).
Geometry(Geometry)
GeoJSON-compatible geometry (Point, LineString, Polygon, etc.).
Set(Vec<Value>)
Ordered set of unique values (auto-deduplicated, maintains insertion order).
Regex(String)
Compiled regex pattern (stored as pattern string).
Range
A range of values with optional bounds.
Fields
Record
A typed reference to another record: table:id.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_datetime(&self) -> Option<&NdbDateTime>
pub fn as_datetime(&self) -> Option<&NdbDateTime>
Try to extract as DateTime.
Sourcepub fn as_duration(&self) -> Option<&NdbDuration>
pub fn as_duration(&self) -> Option<&NdbDuration>
Try to extract as Duration.
Sourcepub fn as_decimal(&self) -> Option<&Decimal>
pub fn as_decimal(&self) -> Option<&Decimal>
Try to extract as Decimal.
Sourcepub fn as_geometry(&self) -> Option<&Geometry>
pub fn as_geometry(&self) -> Option<&Geometry>
Try to extract as Geometry.
Source§impl Value
Object/array access methods for use as internal document representation.
impl Value
Object/array access methods for use as internal document representation.
Sourcepub fn get(&self, field: &str) -> Option<&Value>
pub fn get(&self, field: &str) -> Option<&Value>
Look up a field by name. Returns None for non-Object variants.
Sourcepub fn get_mut(&mut self, field: &str) -> Option<&mut Value>
pub fn get_mut(&mut self, field: &str) -> Option<&mut Value>
Mutable field lookup. Returns None for non-Object variants.
Sourcepub fn as_object(&self) -> Option<&HashMap<String, Value>>
pub fn as_object(&self) -> Option<&HashMap<String, Value>>
Try to extract as an object (HashMap reference).
Source§impl Value
impl Value
Sourcepub fn eq_coerced(&self, other: &Value) -> bool
pub fn eq_coerced(&self, other: &Value) -> bool
Coerced equality: Value vs Value with numeric/string coercion.
Single source of truth for type coercion in filter evaluation.
Used by matches_binary (msgpack path) and matches_value (Value path).
Sourcepub fn cmp_coerced(&self, other: &Value) -> Ordering
pub fn cmp_coerced(&self, other: &Value) -> Ordering
Coerced ordering: Value vs Value with numeric/string coercion.
Single source of truth for ordering in filter/sort evaluation.
Sourcepub fn as_array_iter(&self) -> Option<impl Iterator<Item = &Value>>
pub fn as_array_iter(&self) -> Option<impl Iterator<Item = &Value>>
Get array elements (for IN/array operations).
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>,
Source§impl From<NdbDateTime> for Value
impl From<NdbDateTime> for Value
Source§fn from(dt: NdbDateTime) -> Value
fn from(dt: NdbDateTime) -> Value
Source§impl From<NdbDuration> for Value
impl From<NdbDuration> for Value
Source§fn from(d: NdbDuration) -> Value
fn from(d: NdbDuration) -> Value
Source§impl<'a> FromMessagePack<'a> for Value
impl<'a> FromMessagePack<'a> 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,
Source§impl ToMessagePack for Value
impl ToMessagePack for Value
impl StructuralPartialEq for Value
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> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.