Enum orm::Value
[−]
pub enum Value { NULL, Bytes(Vec<u8>), Int(i64), UInt(u64), Float(f64), Date(u16, u8, u8, u8, u8, u8, u32), Time(bool, u32, u8, u8, u8, u32), }
Value
enumerates possible values in mysql cells. Also Value
used to fill
prepared statements.
Note that to receive something different than Value::NULL
or Value::Bytes
from mysql
you should use prepared statements.
If you want to get something more useful from Value
you should implement
FromValue
on it. To get T: FromValue
from
nullable value you should rely on FromValue
implemented on Option<T>
.
To convert something to Value
you should implement Into<Value>
for it.
use mysql::value::from_row; let mut conn = pool.get_conn().unwrap(); let result = conn.prep_exec("SELECT ? * ?", (20i32, 0.8_f32)).unwrap(); for row in result { let c = from_row::<f32>(row.unwrap()); assert_eq!(c, 16.0_f32); }
Variants
NULL
Bytes(Vec<u8>)
Int(i64)
UInt(u64)
Float(f64)
Date(u16, u8, u8, u8, u8, u8, u32)
year, month, day, hour, minutes, seconds, micro seconds
Time(bool, u32, u8, u8, u8, u32)
is negative, days, hours, minutes, seconds, micro seconds
Methods
impl Value
Trait Implementations
impl Debug for Value
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl PartialOrd<Value> for Value
fn partial_cmp(&self, __arg_0: &Value) -> Option<Ordering>
fn lt(&self, __arg_0: &Value) -> bool
fn le(&self, __arg_0: &Value) -> bool
fn gt(&self, __arg_0: &Value) -> bool
fn ge(&self, __arg_0: &Value) -> bool
impl FromValue for Value
type Intermediate = ValueIr
fn from_value(v: Value) -> Value
Will panic if could not convert v
to Self
.
fn from_value_opt(v: Value) -> Result<Value, Error>
Will return Err(Error::FromValueError(v))
if could not convert v
to Self
.
fn get_intermediate(v: Value) -> Result<Self::Intermediate, Error>
Will return Err(Error::FromValueError(v))
if v
is not convertible to Self
.
impl PartialEq<Value> for Value
fn eq(&self, __arg_0: &Value) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Value) -> bool
This method tests for !=
.
impl Clone for Value
fn clone(&self) -> Value
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a, T> From<&'a T> for Value where
T: ToValue,
T: ToValue,
impl<T> From<Option<T>> for Value where
T: Into<Value>,
T: Into<Value>,
impl From<u64> for Value
impl From<usize> for Value
impl From<f32> for Value
impl From<f64> for Value
impl From<bool> for Value
impl<'a> From<&'a [u8]> for Value
impl From<Vec<u8>> for Value
impl<'a> From<&'a str> for Value
impl From<String> for Value
impl From<NaiveDateTime> for Value
fn from(x: NaiveDateTime) -> Value
Performs the conversion.
impl From<NaiveDate> for Value
impl From<NaiveTime> for Value
impl From<Timespec> for Value
impl From<Duration> for Value
impl From<Duration> for Value
impl From<Value> for Value
impl<T> From<Serialized<T>> for Value where
T: Serialize,
T: Serialize,