use std::ops::Deref; type Value = uuidv7::Uuid; pub struct Uuid(pub Value); #[juniper::graphql_scalar(name = "UUID", description = "UUID encoded as a string")] impl GraphQLScalar for Uuid where S: juniper::ScalarValue, { fn resolve(&self) -> juniper::Value { juniper::Value::scalar(self.0.to_string()) } fn from_input_value(value: &juniper::InputValue) -> Option { value .as_string_value() .and_then(|s| { use uuid_simd::UuidExt; use uuidv7::Uuid; Uuid::parse(s.as_bytes()).ok() }) .map(Uuid) } fn from_str<'a>(value: juniper::ScalarToken<'a>) -> juniper::ParseScalarResult<'a, S> { >::from_str(value) } } impl Deref for Uuid { type Target = Value; fn deref(&self) -> &Self::Target { &self.0 } }