From 2683438ebcae088afc347883c4502f260d38ca85 Mon Sep 17 00:00:00 2001 From: XiNiHa Date: Sun, 2 Oct 2022 05:42:09 +0900 Subject: [PATCH] Conditionally add filter types list with features --- Cargo.toml | 6 +++--- derive/Cargo.toml | 8 +++++++- derive/src/filter.rs | 6 ++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dd3ee06e..426f32b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,6 @@ sea-orm = { version = "^0.9", default-features = false } [features] default = [] -with-chrono = ["sea-orm/with-chrono", "async-graphql/chrono"] -with-decimal = ["sea-orm/with-rust_decimal", "async-graphql/decimal"] -with-uuid = ["sea-orm/with-uuid"] \ No newline at end of file +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-uuid = ["seaography-derive/with-uuid", "sea-orm/with-uuid"] diff --git a/derive/Cargo.toml b/derive/Cargo.toml index 44675c66..06a31bc6 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -20,4 +20,10 @@ quote = "1.0.21" syn = { version = "1.0.99" } proc-macro2 = "1.0.43" bae = "0.1.7" -heck = "0.4.0" \ No newline at end of file +heck = "0.4.0" + +[features] +default = [] +with-chrono = [] +with-decimal = [] +with-uuid = [] diff --git a/derive/src/filter.rs b/derive/src/filter.rs index 150b9476..dbaf2557 100644 --- a/derive/src/filter.rs +++ b/derive/src/filter.rs @@ -62,10 +62,16 @@ pub fn filter_struct( "u64", "f32", "f64", + #[cfg(feature = "with-chrono")] "Date", + #[cfg(feature = "with-chrono")] "DateTime", + #[cfg(feature = "with-chrono")] "DateTimeUtc", + #[cfg(feature = "with-decimal")] "Decimal", + #[cfg(feature = "with-uuid")] + "Uuid", "BinaryVector", "bool", ];