pub enum Value {
Show 37 variants
Int8(i8),
Int16(i16),
Int32(i32),
Int64(i64),
Int128(i128),
Int256(i256),
UInt8(u8),
UInt16(u16),
UInt32(u32),
UInt64(u64),
UInt128(u128),
UInt256(u256),
Float32(f32),
Float64(f64),
Decimal32(usize, i32),
Decimal64(usize, i64),
Decimal128(usize, i128),
Decimal256(usize, i256),
String(Vec<u8>),
Uuid(Uuid),
Date(Date),
Date32(Date32),
DateTime(DateTime),
DateTime64(DynDateTime64),
Enum8(String, i8),
Enum16(String, i16),
Array(Vec<Value>),
Tuple(Vec<Value>),
Null,
Map(Vec<Value>, Vec<Value>),
Ipv4(Ipv4),
Ipv6(Ipv6),
Point(Point),
Ring(Ring),
Polygon(Polygon),
MultiPolygon(MultiPolygon),
Object(Vec<u8>),
}Expand description
A raw ClickHouse value.
Types are not strictly/completely preserved (i.e. types Type::String and Type::FixedString
both are value Type::String). Use this if you want dynamically typed queries.
Variants§
Int8(i8)
Int16(i16)
Int32(i32)
Int64(i64)
Int128(i128)
Int256(i256)
UInt8(u8)
UInt16(u16)
UInt32(u32)
UInt64(u64)
UInt128(u128)
UInt256(u256)
Float32(f32)
Float64(f64)
Decimal32(usize, i32)
Decimal64(usize, i64)
Decimal128(usize, i128)
Decimal256(usize, i256)
String(Vec<u8>)
Uuid(Uuid)
Date(Date)
Date32(Date32)
DateTime(DateTime)
DateTime64(DynDateTime64)
Enum8(String, i8)
Enum16(String, i16)
Array(Vec<Value>)
Tuple(Vec<Value>)
Null
Map(Vec<Value>, Vec<Value>)
Ipv4(Ipv4)
Ipv6(Ipv6)
Point(Point)
Ring(Ring)
Polygon(Polygon)
MultiPolygon(MultiPolygon)
Object(Vec<u8>)
Implementations§
Source§impl Value
impl Value
pub fn string(value: impl Into<String>) -> Self
Sourcepub fn unwrap_array_ref(&self) -> Result<&[Value]>
pub fn unwrap_array_ref(&self) -> Result<&[Value]>
§Errors
Returns an error if the value is not an array.
Sourcepub fn unwrap_array(self) -> Result<Vec<Value>>
pub fn unwrap_array(self) -> Result<Vec<Value>>
§Errors
Returns an error if the value is not an array.
Sourcepub fn unwrap_tuple(self) -> Result<Vec<Value>>
pub fn unwrap_tuple(self) -> Result<Vec<Value>>
§Errors
Returns an error if the value is not a tuple.
pub fn unarray(self) -> Option<Vec<Value>>
Sourcepub fn to_value<T: FromSql>(self, type_: &Type) -> Result<T>
pub fn to_value<T: FromSql>(self, type_: &Type) -> Result<T>
Converts a Value to a T type by calling FromSql::from_sql on T.
§Errors
Returns an error if the conversion fails.
Sourcepub fn from_value<T: ToSql>(value: T) -> Result<Self>
pub fn from_value<T: ToSql>(value: T) -> Result<Self>
Converts a Value to a T type by calling ToSql::to_sql on T.
§Errors
Returns an error if the conversion fails.
Sourcepub fn guess_type(&self) -> Type
pub fn guess_type(&self) -> Type
Guesses a Type from the value, may not correspond to actual column type in ClickHouse
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
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
impl Eq 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.