#[non_exhaustive]pub enum Value {
}Expand description
A bound argument.
keelson carries its own value enum rather than being generic over a driver’s
parameter type. That keeps Expression free of any
backend type parameter, and it means a built query’s arguments can be
inspected — printed, compared, serialised — without a database in the loop.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
SQL NULL.
Bool(bool)
A boolean.
I8(i8)
An 8-bit signed integer.
I16(i16)
A 16-bit signed integer.
I32(i32)
A 32-bit signed integer.
I64(i64)
A 64-bit signed integer.
U8(u8)
An 8-bit unsigned integer.
U16(u16)
A 16-bit unsigned integer.
U32(u32)
A 32-bit unsigned integer.
U64(u64)
A 64-bit unsigned integer.
F32(f32)
A single-precision float.
F64(f64)
A double-precision float.
Text(String)
Character data.
Bytes(Vec<u8>)
Binary data — BYTEA, BLOB.
Array(Vec<Value>)
A homogeneous array, for dialects that have one (PostgreSQL).
Custom(Arc<dyn CustomValue>)
Escape hatch for dialect-specific types. Backends downcast through
CustomValue::as_any.
Implementations§
Source§impl Value
impl Value
Sourcepub fn array<T, I>(items: I) -> Valuewhere
T: ToValue,
I: IntoIterator<Item = T>,
pub fn array<T, I>(items: I) -> Valuewhere
T: ToValue,
I: IntoIterator<Item = T>,
Build a Value::Array from anything iterable.
There is deliberately no blanket ToValue for Vec<T>: it would collide
with Vec<u8>, which must stay Value::Bytes so BYTEA/BLOB binds
correctly. Arrays are therefore explicit.
Sourcepub fn custom<C>(value: C) -> Valuewhere
C: CustomValue,
pub fn custom<C>(value: C) -> Valuewhere
C: CustomValue,
Wrap a dialect-specific value.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Whether this is Value::Null.
Trait Implementations§
Source§impl IntoExprList for Value
impl IntoExprList for Value
Source§fn into_expr_list(self) -> Vec<Expr>
fn into_expr_list(self) -> Vec<Expr>
Source§impl Serialize for Value
Value serialises as the underlying scalar, never as a tagged enum.
impl Serialize for Value
Value serialises as the underlying scalar, never as a tagged enum.
This is what makes Vec<Value> comparable against a plain JSON array of
arguments — Value::I32(100) becomes 100, not {"I32":100} — which is the
shape the test suite compares against.