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].