diff --git a/Cargo.toml b/Cargo.toml index 4183bcd9..e9d0774e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,12 +36,8 @@ sqlx-core = { version = "^0.5", optional = true } sqlx-macros = { version = "^0.5", optional = true } serde_json = { version = "^1", optional = true } uuid = { version = "0.8", features = ["serde", "v4"], optional = true } -rocket = { git = "https://github.com/SergioBenitez/Rocket.git", features = [ - "json", -], optional = true } -rocket_db_pools = { git = "https://github.com/SergioBenitez/Rocket.git", features = [ - "sqlx_mysql", -], optional = true } +rocket_db_pools = { git = "https://github.com/SergioBenitez/Rocket.git", features = ["sqlx_mysql"], optional = true } +async-trait = { version = "0.1", optional = true } [dev-dependencies] smol = { version = "^1.2" } @@ -93,4 +89,4 @@ runtime-actix-rustls = ["sqlx/runtime-actix-rustls", "runtime-actix"] runtime-tokio = [] runtime-tokio-native-tls = ["sqlx/runtime-tokio-native-tls", "runtime-tokio"] runtime-tokio-rustls = ["sqlx/runtime-tokio-rustls", "runtime-tokio"] -rocket-db = ["rocket", "rocket_db_pools"] +web-api-rocket = ["rocket_db_pools", "async-trait"] diff --git a/examples/rocket_example/Cargo.toml b/examples/rocket_example/Cargo.toml index d9f5d738..a8d4e736 100644 --- a/examples/rocket_example/Cargo.toml +++ b/examples/rocket_example/Cargo.toml @@ -5,11 +5,9 @@ edition = "2018" publish = false [workspace] [dependencies] -rocket = { git = "https://github.com/SergioBenitez/Rocket.git", features = [ - "json", -] } +rocket = { git = "https://github.com/SergioBenitez/Rocket.git", features = ["json"] } rocket_db_pools = { git = "https://github.com/SergioBenitez/Rocket.git", features = [] } -sea-orm = { path = "../../", features = ["rocket-db"] } +sea-orm = { path = "../../", features = ["web-api-rocket"] } sea-query = { version = "^0.12.8" } serde_json = { version = "^1" } diff --git a/src/driver/mod.rs b/src/driver/mod.rs index 9b30e6d4..66ea7c79 100644 --- a/src/driver/mod.rs +++ b/src/driver/mod.rs @@ -20,7 +20,7 @@ pub use sqlx_postgres::*; #[cfg(feature = "sqlx-sqlite")] pub use sqlx_sqlite::*; -#[cfg(feature = "rocket-db")] +#[cfg(feature = "web-api-rocket")] mod rocket_db; -#[cfg(feature = "rocket-db")] +#[cfg(feature = "web-api-rocket")] pub use rocket_db::*; diff --git a/src/driver/rocket_db.rs b/src/driver/rocket_db.rs index 512f1fad..755a7fec 100644 --- a/src/driver/rocket_db.rs +++ b/src/driver/rocket_db.rs @@ -1,7 +1,7 @@ -use rocket::figment::Figment; -use rocket_db_pools::{Config, Error}; +use async_trait::async_trait; +use rocket_db_pools::{rocket::figment::Figment, Config, Error}; -#[rocket::async_trait] +#[async_trait] impl rocket_db_pools::Pool for crate::Database { type Error = crate::DbErr;