1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
use crate::{ convert::{unexpected_type, FromSql}, types::Type, Uuid, }; use anyhow::*; use crate::{convert::ToSql, Value}; impl ToSql for Uuid { fn to_sql(self) -> Result<Value> { Ok(Value::Uuid(self)) } } impl FromSql for Uuid { fn from_sql(type_: &Type, value: Value) -> Result<Self> { if !matches!(type_, Type::Uuid) { return Err(unexpected_type(type_)); } match value { Value::Uuid(x) => Ok(x), _ => unimplemented!(), } } }