pub enum Value {
Null,
Bool(bool),
Int(i64),
Float(f64),
Decimal(Decimal),
Text(String),
Bytes(Vec<u8>),
Uuid(Uuid),
Date(NaiveDate),
Time(NaiveTime),
Timestamp(DateTime<Utc>),
Json(Value),
}Expand description
A bindable, backend-neutral value.
Values are always sent to the database as bind parameters, never interpolated into query text.
Backends without a native type for a variant store a canonical text form
(see BACKENDS.md); DbType::from_value
accepts both the native and the text form, so decoding does not depend on
the backend.
Value serializes (untagged) for JSON output of dynamic rows. It does not
deserialize: an untagged Text and Timestamp would be ambiguous.
Variants§
Null
SQL NULL / missing value.
Bool(bool)
Boolean.
Int(i64)
64-bit signed integer.
Float(f64)
64-bit float.
Decimal(Decimal)
Exact decimal.
Text(String)
UTF-8 text.
Bytes(Vec<u8>)
Raw bytes.
Uuid(Uuid)
UUID.
Date(NaiveDate)
Calendar date.
Time(NaiveTime)
Time of day.
Timestamp(DateTime<Utc>)
Instant in UTC.
Json(Value)
Structured JSON document.
Implementations§
Trait Implementations§
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
Mutably borrows from an owned value. Read more