clickhouse_arrow/native/values/
clickhouse_uuid.rs

1use crate::{FromSql, Result, ToSql, Type, Uuid, Value, unexpected_type};
2
3impl ToSql for Uuid {
4    fn to_sql(self, _type_hint: Option<&Type>) -> Result<Value> { Ok(Value::Uuid(self)) }
5}
6
7impl FromSql for Uuid {
8    fn from_sql(type_: &Type, value: Value) -> Result<Self> {
9        if !matches!(type_, Type::Uuid) {
10            return Err(unexpected_type(type_));
11        }
12        match value {
13            Value::Uuid(x) => Ok(x),
14            _ => Err(unexpected_type(type_)),
15        }
16    }
17}