From e7fe48798c589a42ca718dab63938f2a3333087d Mon Sep 17 00:00:00 2001 From: Nicolas Barbotte Date: Sat, 8 Oct 2022 09:15:44 +0000 Subject: [PATCH] Add --with-json feature --- Cargo.toml | 1 + derive/Cargo.toml | 1 + derive/src/filter.rs | 2 ++ src/lib.rs | 5 ++++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 76fb050f..36079105 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,4 +32,5 @@ heck = { version = "0.4.0" } default = [] with-chrono = ["seaography-derive/with-chrono", "sea-orm/with-chrono", "async-graphql/chrono"] with-decimal = ["seaography-derive/with-decimal", "sea-orm/with-rust_decimal", "async-graphql/decimal"] +with-json = ["seaography-derive/with-json", "sea-orm/with-json"] with-uuid = ["seaography-derive/with-uuid", "sea-orm/with-uuid"] diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 06a31bc6..e3bbcf18 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -26,4 +26,5 @@ heck = "0.4.0" default = [] with-chrono = [] with-decimal = [] +with-json = [] with-uuid = [] diff --git a/derive/src/filter.rs b/derive/src/filter.rs index 452ece5f..0522b7be 100644 --- a/derive/src/filter.rs +++ b/derive/src/filter.rs @@ -70,6 +70,8 @@ pub fn filter_struct( "DateTimeUtc", #[cfg(feature = "with-decimal")] "Decimal", + #[cfg(feature = "with-json")] + "Json", #[cfg(feature = "with-uuid")] "Uuid", "BinaryVector", diff --git a/src/lib.rs b/src/lib.rs index 21a5803f..e01a59dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -152,7 +152,10 @@ pub type BinaryVector = Vec; #[graphql(concrete(name = "BigUnsignedFilter", params(u64)))] #[graphql(concrete(name = "FloatFilter", params(f32)))] #[graphql(concrete(name = "DoubleFilter", params(f64)))] -// TODO #[graphql(concrete(name = "JsonFilter", params()))] +#[cfg_attr( + feature = "with-json", + graphql(concrete(name = "JsonFilter", params(sea_orm::prelude::Json))) +)] // TODO #[graphql(concrete(name = "DateFilter", params()))] // TODO #[graphql(concrete(name = "TimeFilter", params()))] #[cfg_attr(