pub enum Value {
Show 24 variants
Bool(Option<bool>),
TinyInt(Option<i8>),
SmallInt(Option<i16>),
Int(Option<i32>),
BigInt(Option<i64>),
TinyUnsigned(Option<u8>),
SmallUnsigned(Option<u16>),
Unsigned(Option<u32>),
BigUnsigned(Option<u64>),
Float(Option<f32>),
Double(Option<f64>),
String(Option<Box<String>>),
Bytes(Option<Box<Vec<u8>>>),
Json(Option<Box<Json>>),
Date(Option<Box<NaiveDate>>),
Time(Option<Box<NaiveTime>>),
DateTime(Option<Box<NaiveDateTime>>),
DateTimeUtc(Option<Box<DateTime<Utc>>>),
DateTimeLocal(Option<Box<DateTime<Local>>>),
DateTimeWithTimeZone(Option<Box<DateTime<FixedOffset>>>),
Uuid(Option<Box<Uuid>>),
Decimal(Option<Box<Decimal>>),
BigDecimal(Option<Box<BigDecimal>>),
Array(Option<Box<Vec<Value>>>),
}
Expand description
Value variants
We want Value to be exactly 1 pointer sized, so anything larger should be boxed.
Variants
Bool(Option<bool>)
TinyInt(Option<i8>)
SmallInt(Option<i16>)
Int(Option<i32>)
BigInt(Option<i64>)
TinyUnsigned(Option<u8>)
SmallUnsigned(Option<u16>)
Unsigned(Option<u32>)
BigUnsigned(Option<u64>)
Float(Option<f32>)
Double(Option<f64>)
String(Option<Box<String>>)
Bytes(Option<Box<Vec<u8>>>)
Json(Option<Box<Json>>)
This is supported on crate feature
with-json
only.Date(Option<Box<NaiveDate>>)
This is supported on crate feature
with-chrono
only.Time(Option<Box<NaiveTime>>)
This is supported on crate feature
with-chrono
only.DateTime(Option<Box<NaiveDateTime>>)
This is supported on crate feature
with-chrono
only.DateTimeUtc(Option<Box<DateTime<Utc>>>)
This is supported on crate feature
with-chrono
only.DateTimeLocal(Option<Box<DateTime<Local>>>)
This is supported on crate feature
with-chrono
only.DateTimeWithTimeZone(Option<Box<DateTime<FixedOffset>>>)
This is supported on crate feature
with-chrono
only.Uuid(Option<Box<Uuid>>)
This is supported on crate feature
with-uuid
only.Decimal(Option<Box<Decimal>>)
This is supported on crate feature
with-rust_decimal
only.BigDecimal(Option<Box<BigDecimal>>)
This is supported on crate feature
with-bigdecimal
only.Array(Option<Box<Vec<Value>>>)
This is supported on crate feature
postgres-array
only.Implementations
sourceimpl Value
impl Value
pub fn is_date_time(&self) -> bool
pub fn as_ref_date_time(&self) -> Option<&NaiveDateTime>
sourceimpl Value
impl Value
pub fn is_date_time_utc(&self) -> bool
pub fn is_date_time_local(&self) -> bool
pub fn is_date_time_with_time_zone(&self) -> bool
pub fn as_ref_date_time_utc(&self) -> Option<&DateTime<Utc>>
pub fn as_ref_date_time_local(&self) -> Option<&DateTime<Local>>
pub fn as_ref_date_time_with_time_zone(&self) -> Option<&DateTime<FixedOffset>>
pub fn as_naive_utc_in_string(&self) -> Option<String>
sourceimpl Value
impl Value
pub fn is_decimal(&self) -> bool
pub fn as_ref_decimal(&self) -> Option<&Decimal>
pub fn decimal_to_f64(&self) -> Option<f64>
sourceimpl Value
impl Value
pub fn is_big_decimal(&self) -> bool
pub fn as_ref_big_decimal(&self) -> Option<&BigDecimal>
pub fn big_decimal_to_f64(&self) -> Option<f64>
Trait Implementations
sourceimpl From<BigDecimal> for Value
This is supported on crate feature with-bigdecimal
only.
impl From<BigDecimal> for Value
This is supported on crate feature
with-bigdecimal
only.sourcefn from(x: BigDecimal) -> Value
fn from(x: BigDecimal) -> Value
Performs the conversion.
sourceimpl From<DateTime<FixedOffset>> for Value
This is supported on crate feature with-chrono
only.
impl From<DateTime<FixedOffset>> for Value
This is supported on crate feature
with-chrono
only.sourcefn from(x: DateTime<FixedOffset>) -> Value
fn from(x: DateTime<FixedOffset>) -> Value
Performs the conversion.
sourceimpl From<NaiveDateTime> for Value
This is supported on crate feature with-chrono
only.
impl From<NaiveDateTime> for Value
This is supported on crate feature
with-chrono
only.sourcefn from(x: NaiveDateTime) -> Value
fn from(x: NaiveDateTime) -> Value
Performs the conversion.
sourceimpl<T> From<Vec<T, Global>> for Value where
T: Into<Value> + NotU8,
This is supported on crate feature postgres-array
only.
impl<T> From<Vec<T, Global>> for Value where
T: Into<Value> + NotU8,
This is supported on crate feature
postgres-array
only.sourceimpl ToSql for Value
impl ToSql for Value
sourcefn to_sql(
&self,
ty: &Type,
out: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
Converts the value of self
into the binary format of the specified
Postgres Type
, appending it to out
. Read more
impl StructuralPartialEq for Value
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> BorrowToSql for T where
T: ToSql,
impl<T> BorrowToSql for T where
T: ToSql,
sourcepub fn borrow_to_sql(&self) -> &dyn ToSql
pub fn borrow_to_sql(&self) -> &dyn ToSql
Returns a reference to self
as a ToSql
trait object.
sourceimpl<V> IntoValueTuple for V where
V: Into<Value>,
impl<V> IntoValueTuple for V where
V: Into<Value>,
fn into_value_tuple(self) -> ValueTuple
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more