From 3c48558ca27f2536592018a4a73d8d40d77f8ccc Mon Sep 17 00:00:00 2001 From: Rushmore Mushambi Date: Tue, 12 Sep 2023 15:34:58 +0100 Subject: [PATCH] Fix decimal deserialisation (#2687) --- lib/Cargo.toml | 2 +- lib/tests/api/mod.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Cargo.toml b/lib/Cargo.toml index b265a190..8af3af86 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -96,7 +96,7 @@ reqwest = { version = "0.11.18", default-features = false, features = ["json", " revision = "0.5.0" roaring = { version = "0.10.2", features = ["serde"] } rocksdb = { version = "0.21.0", optional = true } -rust_decimal = { version = "1.31.0", features = ["maths"] } +rust_decimal = { version = "1.31.0", features = ["maths", "serde-str"] } rust-stemmers = "1.2.0" rustls = { version = "0.20.8", optional = true } scrypt = "0.11.0" diff --git a/lib/tests/api/mod.rs b/lib/tests/api/mod.rs index c57c8fc4..340324cf 100644 --- a/lib/tests/api/mod.rs +++ b/lib/tests/api/mod.rs @@ -191,6 +191,18 @@ async fn query() { assert_eq!(name, "John Doe"); } +#[tokio::test] +async fn query_decimals() { + let db = new_db().await; + db.use_ns(NS).use_db(Ulid::new().to_string()).await.unwrap(); + let sql = " + DEFINE TABLE foo; + DEFINE FIELD bar ON foo TYPE decimal; + CREATE foo CONTENT { bar: 42.69 }; + "; + let _ = db.query(sql).await.unwrap().check().unwrap(); +} + #[tokio::test] async fn query_binds() { let db = new_db().await;