pub enum Value {
Null,
Bool(bool),
Int(i64),
Float(f64),
Text(String),
Bytes(Vec<u8>),
Array(Vec<Value>),
Map(HashMap<String, Value>),
Uuid(Uuid),
DateTime(DateTime<Utc>),
Json(Value),
}Expand description
Universal value type that maps across SQL and NoSQL backends.
Value is the lingua franca between your Rust types and the database.
The #[derive(Model)] macro converts struct fields into Value for
to_row() and back again for from_row().
From implementations exist for all common Rust primitives so you
can pass values inline without explicit construction:
.r#where("age", CondOp::Gte, 18i32) // i32 → Value::Int
.r#where("name", CondOp::Eq, "Alice") // &str → Value::Text
.r#where("active", CondOp::Eq, true) // bool → Value::BoolVariants§
Null
SQL NULL / BSON null.
Bool(bool)
Boolean value.
Int(i64)
64-bit signed integer — covers i8 through i64.
Float(f64)
64-bit float — covers f32 and f64.
Text(String)
UTF-8 string.
Bytes(Vec<u8>)
Raw byte blob.
Array(Vec<Value>)
Ordered list of values (SQL arrays, BSON arrays).
Map(HashMap<String, Value>)
Arbitrary key-value map (JSONB, BSON document embedded field).
Uuid(Uuid)
UUID stored natively in Postgres, as string in MySQL/MongoDB.
DateTime(DateTime<Utc>)
UTC timestamp.
Json(Value)
Arbitrary JSON — stored as JSONB in Postgres, JSON in MySQL, document in Mongo.