pub enum Value {
Show 30 variants
Null,
Boolean(Option<bool>),
Int8(Option<i8>),
Int16(Option<i16>),
Int32(Option<i32>),
Int64(Option<i64>),
Int128(Option<i128>),
UInt8(Option<u8>),
UInt16(Option<u16>),
UInt32(Option<u32>),
UInt64(Option<u64>),
UInt128(Option<u128>),
Float32(Option<f32>),
Float64(Option<f64>),
Decimal(Option<Decimal>, u8, u8),
Char(Option<char>),
Varchar(Option<Cow<'static, str>>),
Blob(Option<Box<[u8]>>),
Date(Option<Date>),
Time(Option<Time>),
Timestamp(Option<PrimitiveDateTime>),
TimestampWithTimezone(Option<OffsetDateTime>),
Interval(Option<Interval>),
Uuid(Option<Uuid>),
Array(Option<Box<[Value]>>, Box<Value>, u32),
List(Option<Vec<Value>>, Box<Value>),
Map(Option<HashMap<Value, Value>>, Box<Value>, Box<Value>),
Json(Option<Value>),
Struct(Option<Vec<(String, Value)>>, Vec<(String, Value)>, TableRef),
Unknown(Option<String>),
}Expand description
SQL value representation used across Tank.
Variants hold Option<T> to store the actual value (None means SQL NULL) and additional needed type information.
Variants§
Null
Untyped NULL.
Boolean(Option<bool>)
Int8(Option<i8>)
Int16(Option<i16>)
Int32(Option<i32>)
Int64(Option<i64>)
Int128(Option<i128>)
UInt8(Option<u8>)
UInt16(Option<u16>)
UInt32(Option<u32>)
UInt64(Option<u64>)
UInt128(Option<u128>)
Float32(Option<f32>)
Float64(Option<f64>)
Decimal(Option<Decimal>, u8, u8)
Decimal with width and scale information.
Char(Option<char>)
Varchar(Option<Cow<'static, str>>)
Blob(Option<Box<[u8]>>)
Date(Option<Date>)
Time(Option<Time>)
Timestamp(Option<PrimitiveDateTime>)
TimestampWithTimezone(Option<OffsetDateTime>)
Interval(Option<Interval>)
Uuid(Option<Uuid>)
Array(Option<Box<[Value]>>, Box<Value>, u32)
Fixed-size homogeneous array.
List(Option<Vec<Value>>, Box<Value>)
Variable-length homogeneous list.
Map(Option<HashMap<Value, Value>>, Box<Value>, Box<Value>)
Map with homogeneous key/value types.
Json(Option<Value>)
Struct(Option<Vec<(String, Value)>>, Vec<(String, Value)>, TableRef)
Struct with named fields and types.
Unknown(Option<String>)
Unknown value type (usually the driver cannot provide type information).
Implementations§
Trait Implementations§
Source§impl AsValue for Value
impl AsValue for Value
Source§fn as_empty_value() -> Value
fn as_empty_value() -> Value
Return a NULL equivalent variant for this type.
Source§impl Expression for Value
impl Expression for Value
Source§impl From<Value> for DefaultValueType
impl From<Value> for DefaultValueType
Source§impl OpPrecedence for Value
impl OpPrecedence for Value
Source§fn precedence(&self, _writer: &dyn SqlWriter) -> i32
fn precedence(&self, _writer: &dyn SqlWriter) -> i32
Lower numbers bind weaker, writers parenthesize when child precedence <= operator precedence.
Source§impl ToTokens for Value
impl ToTokens for Value
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
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<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.