diff --git a/Cargo.lock b/Cargo.lock index 5390aa28..82fb76c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3882,9 +3882,9 @@ dependencies = [ [[package]] name = "surrealdb-derive" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb39273220b1d4cd0936abb8d1e9ec0eb673e17044169cb4604345576b1e0ef" +checksum = "0e0f2a75e22417f587cf23a5efa9f680f4002b8655b8481a01ee5e787f15d82b" dependencies = [ "quote", "syn 1.0.109", diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 6bbfb449..9988d123 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -59,7 +59,7 @@ bigdecimal = { version = "0.3.0", features = ["serde", "string-only"] } bung = "0.1.0" channel = { version = "1.8.0", package = "async-channel" } chrono = { version = "0.4.24", features = ["serde"] } -derive = { version = "0.6.0", package = "surrealdb-derive" } +derive = { version = "0.7.0", package = "surrealdb-derive" } dmp = "0.1.3" echodb = { version = "0.4.0", optional = true } executor = { version = "1.5.0", package = "async-executor" } diff --git a/lib/src/sql/statements/define.rs b/lib/src/sql/statements/define.rs index a5fa1e91..9cfb7a64 100644 --- a/lib/src/sql/statements/define.rs +++ b/lib/src/sql/statements/define.rs @@ -41,6 +41,7 @@ use serde::{Deserialize, Serialize}; use std::fmt::{self, Display, Write}; #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] +#[format(Named)] pub enum DefineStatement { Namespace(DefineNamespaceStatement), Database(DefineDatabaseStatement), @@ -1253,3 +1254,17 @@ fn index(i: &str) -> IResult<&str, DefineIndexStatement> { }, )) } + +#[cfg(test)] +mod tests { + + use super::*; + + #[test] + fn check_define_serialize() { + let stm = DefineStatement::Namespace(DefineNamespaceStatement { + name: Ident::from("test"), + }); + assert_eq!(22, stm.to_vec().len()); + } +} diff --git a/lib/src/sql/statements/remove.rs b/lib/src/sql/statements/remove.rs index 7a46e93b..8099e436 100644 --- a/lib/src/sql/statements/remove.rs +++ b/lib/src/sql/statements/remove.rs @@ -22,6 +22,7 @@ use serde::{Deserialize, Serialize}; use std::fmt::{self, Display, Formatter}; #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize, Store, Hash)] +#[format(Named)] pub enum RemoveStatement { Namespace(RemoveNamespaceStatement), Database(RemoveDatabaseStatement), @@ -798,3 +799,17 @@ fn index(i: &str) -> IResult<&str, RemoveIndexStatement> { }, )) } + +#[cfg(test)] +mod tests { + + use super::*; + + #[test] + fn check_remove_serialize() { + let stm = RemoveStatement::Namespace(RemoveNamespaceStatement { + name: Ident::from("test"), + }); + assert_eq!(22, stm.to_vec().len()); + } +} diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index 6ff92148..1d93d277 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -99,6 +99,7 @@ pub fn whats(i: &str) -> IResult<&str, Values> { } #[derive(Clone, Debug, Default, PartialEq, PartialOrd, Deserialize, Store, Hash)] +#[format(Compact)] pub enum Value { #[default] None,