From 7bf79ae5bffb19be506e3a3ac15e7659fa3389af Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Wed, 30 Jun 2021 11:02:04 +0800 Subject: [PATCH] Re-export strum_macros --- Cargo.toml | 2 +- examples/sqlx-mysql/Cargo.toml | 1 - examples/sqlx-mysql/src/example_cake.rs | 3 +++ examples/sqlx-mysql/src/example_cake_filling.rs | 3 +++ examples/sqlx-mysql/src/example_filling.rs | 3 +++ examples/sqlx-mysql/src/example_fruit.rs | 3 +++ src/lib.rs | 1 + src/tests_cfg/cake.rs | 3 +++ src/tests_cfg/cake_filling.rs | 3 +++ src/tests_cfg/filling.rs | 3 +++ src/tests_cfg/fruit.rs | 3 +++ 11 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0268df58..1a488d85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ sea-query = { version = "^0.12" } sea-orm-macros = { path = "sea-orm-macros", optional = true } serde = { version = "^1.0", features = [ "derive" ] } sqlx = { version = "^0.5", optional = true } -strum = { version = "^0.20", features = [ "derive" ] } +strum = { path = "../strum/strum", version = "^0.21", features = [ "derive" ] } serde_json = { version = "^1", optional = true } [dev-dependencies] diff --git a/examples/sqlx-mysql/Cargo.toml b/examples/sqlx-mysql/Cargo.toml index a9e1d9ae..ae622523 100644 --- a/examples/sqlx-mysql/Cargo.toml +++ b/examples/sqlx-mysql/Cargo.toml @@ -7,7 +7,6 @@ publish = false [dependencies] async-std = { version = "^1.9", features = [ "attributes" ] } sea-orm = { path = "../../", features = [ "sqlx-mysql", "runtime-async-std-native-tls", "debug-print", "with-json", "macros" ], default-features = false } -strum = { version = "^0.20", features = [ "derive" ] } serde_json = { version = "^1" } futures = { version = "^0.3" } async-stream = { version = "^0.3" } diff --git a/examples/sqlx-mysql/src/example_cake.rs b/examples/sqlx-mysql/src/example_cake.rs index 475315e8..714bb19a 100644 --- a/examples/sqlx-mysql/src/example_cake.rs +++ b/examples/sqlx-mysql/src/example_cake.rs @@ -16,12 +16,14 @@ pub struct Model { } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +#[strum(crate_path = "sea_orm::strum")] pub enum Column { Id, Name, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +#[strum(crate_path = "sea_orm::strum")] pub enum PrimaryKey { Id, } @@ -33,6 +35,7 @@ impl PrimaryKeyTrait for PrimaryKey { } #[derive(Copy, Clone, Debug, EnumIter)] +#[strum(crate_path = "sea_orm::strum")] pub enum Relation { Fruit, } diff --git a/examples/sqlx-mysql/src/example_cake_filling.rs b/examples/sqlx-mysql/src/example_cake_filling.rs index 19de83e4..f38555a1 100644 --- a/examples/sqlx-mysql/src/example_cake_filling.rs +++ b/examples/sqlx-mysql/src/example_cake_filling.rs @@ -16,12 +16,14 @@ pub struct Model { } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +#[strum(crate_path = "sea_orm::strum")] pub enum Column { CakeId, FillingId, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +#[strum(crate_path = "sea_orm::strum")] pub enum PrimaryKey { CakeId, FillingId, @@ -34,6 +36,7 @@ impl PrimaryKeyTrait for PrimaryKey { } #[derive(Copy, Clone, Debug, EnumIter)] +#[strum(crate_path = "sea_orm::strum")] pub enum Relation { Cake, Filling, diff --git a/examples/sqlx-mysql/src/example_filling.rs b/examples/sqlx-mysql/src/example_filling.rs index 925b92fc..b8e40072 100644 --- a/examples/sqlx-mysql/src/example_filling.rs +++ b/examples/sqlx-mysql/src/example_filling.rs @@ -16,12 +16,14 @@ pub struct Model { } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +#[strum(crate_path = "sea_orm::strum")] pub enum Column { Id, Name, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +#[strum(crate_path = "sea_orm::strum")] pub enum PrimaryKey { Id, } @@ -33,6 +35,7 @@ impl PrimaryKeyTrait for PrimaryKey { } #[derive(Copy, Clone, Debug, EnumIter)] +#[strum(crate_path = "sea_orm::strum")] pub enum Relation {} impl ColumnTrait for Column { diff --git a/examples/sqlx-mysql/src/example_fruit.rs b/examples/sqlx-mysql/src/example_fruit.rs index b875da24..ced70c88 100644 --- a/examples/sqlx-mysql/src/example_fruit.rs +++ b/examples/sqlx-mysql/src/example_fruit.rs @@ -17,6 +17,7 @@ pub struct Model { } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +#[strum(crate_path = "sea_orm::strum")] pub enum Column { Id, Name, @@ -24,6 +25,7 @@ pub enum Column { } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +#[strum(crate_path = "sea_orm::strum")] pub enum PrimaryKey { Id, } @@ -35,6 +37,7 @@ impl PrimaryKeyTrait for PrimaryKey { } #[derive(Copy, Clone, Debug, EnumIter)] +#[strum(crate_path = "sea_orm::strum")] pub enum Relation { Cake, } diff --git a/src/lib.rs b/src/lib.rs index 1678b171..45f27470 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -216,3 +216,4 @@ pub use sea_orm_macros::{ pub use sea_query; pub use sea_query::Iden; pub use strum::EnumIter; +pub use strum; diff --git a/src/tests_cfg/cake.rs b/src/tests_cfg/cake.rs index f8a35d6c..8332111b 100644 --- a/src/tests_cfg/cake.rs +++ b/src/tests_cfg/cake.rs @@ -17,12 +17,14 @@ pub struct Model { } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +#[strum(crate_path = "sea_orm::strum")] pub enum Column { Id, Name, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +#[strum(crate_path = "sea_orm::strum")] pub enum PrimaryKey { Id, } @@ -34,6 +36,7 @@ impl PrimaryKeyTrait for PrimaryKey { } #[derive(Copy, Clone, Debug, EnumIter)] +#[strum(crate_path = "sea_orm::strum")] pub enum Relation { Fruit, } diff --git a/src/tests_cfg/cake_filling.rs b/src/tests_cfg/cake_filling.rs index 6b5c20aa..c3a66023 100644 --- a/src/tests_cfg/cake_filling.rs +++ b/src/tests_cfg/cake_filling.rs @@ -17,12 +17,14 @@ pub struct Model { } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +#[strum(crate_path = "sea_orm::strum")] pub enum Column { CakeId, FillingId, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +#[strum(crate_path = "sea_orm::strum")] pub enum PrimaryKey { CakeId, FillingId, @@ -35,6 +37,7 @@ impl PrimaryKeyTrait for PrimaryKey { } #[derive(Copy, Clone, Debug, EnumIter)] +#[strum(crate_path = "sea_orm::strum")] pub enum Relation { Cake, Filling, diff --git a/src/tests_cfg/filling.rs b/src/tests_cfg/filling.rs index a246d146..8f572436 100644 --- a/src/tests_cfg/filling.rs +++ b/src/tests_cfg/filling.rs @@ -17,12 +17,14 @@ pub struct Model { } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +#[strum(crate_path = "sea_orm::strum")] pub enum Column { Id, Name, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +#[strum(crate_path = "sea_orm::strum")] pub enum PrimaryKey { Id, } @@ -34,6 +36,7 @@ impl PrimaryKeyTrait for PrimaryKey { } #[derive(Copy, Clone, Debug, EnumIter)] +#[strum(crate_path = "sea_orm::strum")] pub enum Relation {} impl ColumnTrait for Column { diff --git a/src/tests_cfg/fruit.rs b/src/tests_cfg/fruit.rs index 0511ae58..67d1d07e 100644 --- a/src/tests_cfg/fruit.rs +++ b/src/tests_cfg/fruit.rs @@ -18,6 +18,7 @@ pub struct Model { } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +#[strum(crate_path = "sea_orm::strum")] pub enum Column { Id, Name, @@ -25,6 +26,7 @@ pub enum Column { } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +#[strum(crate_path = "sea_orm::strum")] pub enum PrimaryKey { Id, } @@ -36,6 +38,7 @@ impl PrimaryKeyTrait for PrimaryKey { } #[derive(Copy, Clone, Debug, EnumIter)] +#[strum(crate_path = "sea_orm::strum")] pub enum Relation { Cake, }