pub enum Value {
}Expand description
A generic wrapper enum to hold any DBMS value.
Variants§
Blob(Blob)
Boolean(Boolean)
Date(Date)
DateTime(DateTime)
Decimal(Decimal)
Int8(Int8)
Int16(Int16)
Int32(Int32)
Int64(Int64)
Json(Json)
Null
Text(Text)
Uint8(Uint8)
Uint16(Uint16)
Uint32(Uint32)
Uint64(Uint64)
Uuid(Uuid)
Custom(CustomValue)
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_boolean(&self) -> Option<&Boolean>
pub fn as_boolean(&self) -> Option<&Boolean>
Attempts to extract a reference to the inner value if it matches the variant.
Source§impl Value
impl Value
Sourcepub fn as_datetime(&self) -> Option<&DateTime>
pub fn as_datetime(&self) -> Option<&DateTime>
Attempts to extract a reference to the inner value if it matches the variant.
Source§impl Value
impl Value
Sourcepub fn as_decimal(&self) -> Option<&Decimal>
pub fn as_decimal(&self) -> Option<&Decimal>
Attempts to extract a reference to the inner value if it matches the variant.
Source§impl Value
impl Value
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Checks if the value is Value::Null.
Sourcepub fn as_custom(&self) -> Option<&CustomValue>
pub fn as_custom(&self) -> Option<&CustomValue>
Returns reference to the inner [CustomValue] if this is a Custom variant.
Sourcepub fn as_custom_type<T>(&self) -> Option<T>where
T: CustomDataType,
pub fn as_custom_type<T>(&self) -> Option<T>where
T: CustomDataType,
Attempts to decode a Custom variant into a concrete CustomDataType.
Returns None if this is not a Custom variant, the type tag doesn’t
match, or decoding fails.
Trait Implementations§
Source§impl CandidType for Value
impl CandidType for Value
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 Encode for Value
Encodes a Value as [discriminant: u8] + [inner_type.encode()].
impl Encode for Value
Encodes a Value as [discriminant: u8] + [inner_type.encode()].
For Null, only the discriminant byte is written.
For Custom, the encoding is [discriminant] + [tag_len: u16 LE] + [tag_bytes] + [data_len: u16 LE] + [encoded_bytes].
Source§impl Ord for Value
impl Ord for Value
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,
impl Eq 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> 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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<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.