pub enum Value {
Null,
Number(Number),
Bytes(Bytes),
Timestamp(NaiveDateTime, Tz),
Interval(i64),
// some variants omitted
}
Expand description
A scalar value.
Variants
Null
Null.
Number(Number)
A number.
Bytes(Bytes)
A string or byte string.
Timestamp(NaiveDateTime, Tz)
A timestamp.
Interval(i64)
A time interval, as multiple of microseconds.
Implementations
sourceimpl Value
impl Value
sourcepub fn new_timestamp(ts: NaiveDateTime, tz: Tz) -> Self
pub fn new_timestamp(ts: NaiveDateTime, tz: Tz) -> Self
Creates a timestamp value.
sourcepub fn sql_cmp(
&self,
other: &Self,
name: Function
) -> Result<Option<Ordering>, Error>
pub fn sql_cmp(
&self,
other: &Self,
name: Function
) -> Result<Option<Ordering>, Error>
Compares two values using the rules common among SQL implementations.
- Comparing with NULL always return
None
. - Numbers and intervals are ordered by value.
- Timestamps are ordered by its UTC value, ignoring time zone.
- Strings are ordered by UTF-8 binary collation.
- Comparing between different types are inconsistent among database
engines, thus this function will just error with
InvalidArguments
.
sourcepub fn sql_add(&self, other: &Self) -> Result<Self, Error>
pub fn sql_add(&self, other: &Self) -> Result<Self, Error>
Adds two values using the rules common among SQL implementations.
sourcepub fn sql_sub(&self, other: &Self) -> Result<Self, Error>
pub fn sql_sub(&self, other: &Self) -> Result<Self, Error>
Subtracts two values using the rules common among SQL implementations.
sourcepub fn sql_mul(&self, other: &Self) -> Result<Self, Error>
pub fn sql_mul(&self, other: &Self) -> Result<Self, Error>
Multiplies two values using the rules common among SQL implementations.
sourcepub fn sql_float_div(&self, other: &Self) -> Result<Self, Error>
pub fn sql_float_div(&self, other: &Self) -> Result<Self, Error>
Divides two values using the rules common among SQL implementations.
Trait Implementations
sourceimpl<'s> TryFromValue<'s> for &'s Value
impl<'s> TryFromValue<'s> for &'s Value
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more