edgedb / edgedb-rust

The official Rust binding for EdgeDB
https://edgedb.com
Apache License 2.0
209 stars 26 forks source link

Implement `From<model::*> for Value` #317

Closed MrFoxPro closed 2 months ago

MrFoxPro commented 2 months ago

So instead of

let args = named_args! {
   "id" => edb_model::Uuid::from_str(&otp_request.id)?.to_value()?,
   "confirmed_at" => edb_model::Datetime::try_from(Utc::now())?.to_value()?
};

we will write

let args = named_args! {
   "id" => edb_model::Uuid::from_str(&otp_request.id)?,
   "confirmed_at" => edb_model::Datetime::try_from(Utc::now())?
};

Note: I'm using .expect() and not try_from because as I saw all to_value implementations do not fail at all