diff --git a/lib/src/sql/array.rs b/lib/src/sql/array.rs index d848f2b8..073c7dd3 100644 --- a/lib/src/sql/array.rs +++ b/lib/src/sql/array.rs @@ -60,6 +60,12 @@ impl From> for Array { } } +impl From for Vec { + fn from(s: Array) -> Self { + s.0 + } +} + impl Deref for Array { type Target = Vec; fn deref(&self) -> &Self::Target { diff --git a/lib/src/sql/uuid.rs b/lib/src/sql/uuid.rs index 0c8cb694..9d4e0b82 100644 --- a/lib/src/sql/uuid.rs +++ b/lib/src/sql/uuid.rs @@ -34,6 +34,12 @@ impl From for Uuid { } } +impl From for uuid::Uuid { + fn from(s: Uuid) -> Self { + s.0 + } +} + impl Deref for Uuid { type Target = uuid::Uuid; fn deref(&self) -> &Self::Target { diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index d0f2681e..c2013b0b 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -535,6 +535,36 @@ impl TryFrom for DateTime { } } +impl TryFrom for uuid::Uuid { + type Error = Error; + fn try_from(value: Value) -> Result { + match value { + Value::Uuid(x) => Ok(x.into()), + _ => Err(Error::TryFromError(value.to_string(), "uuid::Uuid")), + } + } +} + +impl TryFrom for Vec { + type Error = Error; + fn try_from(value: Value) -> Result { + match value { + Value::Array(x) => Ok(x.into()), + _ => Err(Error::TryFromError(value.to_string(), "Vec")), + } + } +} + +impl TryFrom for Object { + type Error = Error; + fn try_from(value: Value) -> Result { + match value { + Value::Object(x) => Ok(x), + _ => Err(Error::TryFromError(value.to_string(), "Object")), + } + } +} + impl Value { // ----------------------------------- // Initial record value