Enum butane_core::sqlval::SqlVal
source · pub enum SqlVal {
Null,
Bool(bool),
Int(i32),
BigInt(i64),
Real(f64),
Text(String),
Blob(Vec<u8>),
Custom(Box<SqlValCustom>),
}
Expand description
Variants§
Null
Bool(bool)
Int(i32)
BigInt(i64)
Real(f64)
Text(String)
Blob(Vec<u8>)
Custom(Box<SqlValCustom>)
Implementations§
source§impl SqlVal
impl SqlVal
pub fn as_ref(&self) -> SqlValRef<'_>
pub fn bool(&self) -> Result<bool>
pub fn integer(&self) -> Result<i32>
pub fn bigint(&self) -> Result<i64>
pub fn real(&self) -> Result<f64>
pub fn text(&self) -> Result<&str>
pub fn owned_text(self) -> Result<String>
pub fn blob(&self) -> Result<&[u8]>
pub fn owned_blob(self) -> Result<Vec<u8>>
sourcepub fn is_compatible(&self, t: &SqlType, null_allowed: bool) -> bool
pub fn is_compatible(&self, t: &SqlType, null_allowed: bool) -> bool
Tests if this sqlval is compatible with the given
SqlType
. There are no implicit type conversions (i.e. if
this is a SqlVal::Bool
, it is only compatible with
SqlType::Bool
, not with SqlType::Int
, even though an int
contains enough information to encode a bool.
pub fn sqltype(&self) -> Option<SqlType>
Trait Implementations§
source§impl<'de> Deserialize<'de> for SqlVal
impl<'de> Deserialize<'de> for SqlVal
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<SqlVal> for SqlVal
impl PartialEq<SqlVal> for SqlVal
impl StructuralPartialEq for SqlVal
Auto Trait Implementations§
impl RefUnwindSafe for SqlVal
impl Send for SqlVal
impl Sync for SqlVal
impl Unpin for SqlVal
impl UnwindSafe for SqlVal
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