pub enum Value {
Int(i64),
Float(f64),
Str(String),
Bool(bool),
List(Vec<Value>),
Map(BTreeMap<String, Value>),
Date(i32),
LocalDateTime(i64),
DateTime {
micros_utc: i64,
offset_seconds: i32,
},
Duration {
months: i32,
days: i32,
nanos: i64,
},
Binary(Vec<u8>),
Null,
}Expand description
A property or query value.
§Serde tags are a storage format
bincode encodes a variant by its declaration index, and the WAL, the
mixed-column blob and snapshots all store Value that way. A variant is
therefore only ever added, never reordered or removed, and a new storable
variant goes before Null, which is always last. The index of every
variant is pinned by types::tests::value_serde_tags_are_pinned; changing
it means changing that test deliberately.
Variants§
Int(i64)
Float(f64)
Str(String)
Bool(bool)
List(Vec<Value>)
Map(BTreeMap<String, Value>)
Nested key-value map. Spills to the Mixed column path like List.
Never promotes a homogeneous typed column. Not fulltext-indexed.
Date(i32)
Calendar date: days since 1970-01-01. JSON form {"$date": "2024-01-15"}.
LocalDateTime(i64)
Date and time with no time zone: microseconds since 1970-01-01T00:00:00.
JSON form {"$ldt": "2024-01-15T12:34:56.789012"}.
DateTime
An instant plus the UTC offset it was written with. The offset is kept
so the value prints back as written; equality and ordering in queries
and in index keys use micros_utc only. A valid offset is within
±18:00 (MAX_OFFSET_SECONDS).
JSON form {"$dt": "2024-01-15T12:34:56.789012+05:30"}.
Duration
openCypher duration: months, days and nanoseconds are independent and
never normalized against each other (a month is not 30 days). Not
totally ordered. JSON form {"$dur": "P1Y2M3DT4H5M6.789S"}.
Binary(Vec<u8>)
Byte blob, no encoding assumed. JSON form {"$binary": "<base64>"}.
Null
Null as an element of a list or a value of a map, produced only by
query evaluation ([1, null], {a: n.missing}). A top-level query
null is still Option<Value>::None.
Query-only: it is never stored. The write path refuses a property
value that holds one, and the WAL frame and column encoders refuse it
again as a backstop. It serialises like any unit variant (bincode tag =
its index; serde JSON "Null"), so a query result carrying it can be
sent anywhere a Value can.
Must stay the last variant. Add new variants above it.
Implementations§
Source§impl Value
impl Value
Sourcepub fn contains_null(&self) -> bool
pub fn contains_null(&self) -> bool
True if this value is Value::Null or holds one at any depth. A
write path refuses such a value: a stored property can never be null.
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 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,
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Forget for Value
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.