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.
Variants correspond to database column types.
Variants§
Null
SQL NULL.
Boolean(Option<bool>)
Boolean value.
Int8(Option<i8>)
8-bit signed integer.
Int16(Option<i16>)
16-bit signed integer.
Int32(Option<i32>)
32-bit signed integer.
Int64(Option<i64>)
64-bit signed integer.
Int128(Option<i128>)
128-bit signed integer.
UInt8(Option<u8>)
8-bit unsigned integer.
UInt16(Option<u16>)
16-bit unsigned integer.
UInt32(Option<u32>)
32-bit unsigned integer.
UInt64(Option<u64>)
64-bit unsigned integer.
UInt128(Option<u128>)
128-bit unsigned integer.
Float32(Option<f32>)
32-bit floating point number.
Float64(Option<f64>)
64-bit floating point number.
Decimal(Option<Decimal>, u8, u8)
Decimal (value, precision, scale).
Char(Option<char>)
Single character.
Varchar(Option<Cow<'static, str>>)
Variable-length character string.
Blob(Option<Box<[u8]>>)
Binary large object.
Date(Option<Date>)
Date value (without time).
Time(Option<Time>)
Time value (without date).
Timestamp(Option<PrimitiveDateTime>)
Timestamp (date and time).
TimestampWithTimezone(Option<OffsetDateTime>)
Timestamp with time zone.
Interval(Option<Interval>)
Time interval.
Uuid(Option<Uuid>)
UUID (Universally Unique Identifier).
Array(Option<Box<[Value]>>, Box<Value>, u32)
Homogeneous array (values, inner type, length).
List(Option<Vec<Value>>, Box<Value>)
Variable-length list (values, inner type).
Map(Option<HashMap<Value, Value>>, Box<Value>, Box<Value>)
Map (entries, key type, value type).
Json(Option<Value>)
JSON value.
Struct(Option<Vec<(String, Value)>>, Vec<(String, Value)>, TableRef)
Named struct (fields, field types, type name).
Unknown(Option<String>)
Unknown type (usually used when no further information is available).
Implementations§
Source§impl Value
impl Value
Sourcepub fn same_type(&self, other: &Self) -> bool
pub fn same_type(&self, other: &Self) -> bool
Checks if two values have the same type, ignoring their actual data.
Sourcepub fn as_null(&self) -> Value
pub fn as_null(&self) -> Value
Create a value retaining only the type information, with all data set to NULL.
Trait Implementations§
Source§impl Expression for Value
impl Expression for Value
Source§fn write_query(
&self,
writer: &dyn SqlWriter,
context: &mut Context,
out: &mut DynQuery,
)
fn write_query( &self, writer: &dyn SqlWriter, context: &mut Context, out: &mut DynQuery, )
Source§fn accept_visitor(
&self,
matcher: &mut dyn ExpressionVisitor,
writer: &dyn SqlWriter,
context: &mut Context,
out: &mut DynQuery,
) -> bool
fn accept_visitor( &self, matcher: &mut dyn ExpressionVisitor, writer: &dyn SqlWriter, context: &mut Context, out: &mut DynQuery, ) -> bool
Source§fn as_identifier(&self, context: &mut Context) -> String
fn as_identifier(&self, context: &mut Context) -> String
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
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 UnsafeUnpin 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
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
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.