#[non_exhaustive]pub enum Value {
Null,
Bool(bool),
Int(i64),
Float(f64),
String(String),
Array(Vec<Self>),
}Expand description
SQL parameter values.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Null
SQL NULL value.
Bool(bool)
Boolean value (true/false).
Int(i64)
64-bit signed integer.
Float(f64)
64-bit floating point number.
String(String)
UTF-8 string value.
Array(Vec<Self>)
Array of values (for IN, BETWEEN operators).
Implementations§
Source§impl Value
impl Value
Sourcepub fn from_json(json: &JsonValue) -> Option<Self>
pub fn from_json(json: &JsonValue) -> Option<Self>
Convert from miniserde JSON value.
§Example
use mik_sql::Value;
use miniserde::json::{Value as JsonValue, Number};
let json = JsonValue::String("hello".to_string());
assert_eq!(Value::from_json(&json), Some(Value::String("hello".to_string())));
let json = JsonValue::Number(Number::I64(42));
assert_eq!(Value::from_json(&json), Some(Value::Int(42)));Trait Implementations§
impl StructuralPartialEq 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