diff --git a/Cargo.toml b/Cargo.toml index a096135d..a5d534c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,12 +23,10 @@ path = "src/lib.rs" [dependencies] async-stream = { version = "^0.3" } -async-trait = { version = "0.1", optional = true } chrono = { version = "^0", optional = true } futures = { version = "^0.3" } futures-util = { version = "^0.3" } log = { version = "^0.4", optional = true } -rocket_db_pools = { git = "https://github.com/SergioBenitez/Rocket.git", optional = true } rust_decimal = { version = "^1", optional = true } sea-orm-macros = { version = "^0.1.1", path = "sea-orm-macros", optional = true } sea-query = { version = "^0.16", features = ["thread-safe"] } @@ -92,4 +90,3 @@ 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"] -web-api-rocket = ["rocket_db_pools", "async-trait"] diff --git a/examples/rocket_example/Cargo.toml b/examples/rocket_example/Cargo.toml index 644dd412..944f8da5 100644 --- a/examples/rocket_example/Cargo.toml +++ b/examples/rocket_example/Cargo.toml @@ -9,6 +9,7 @@ publish = false [dependencies] async-stream = { version = "^0.3" } +async-trait = { version = "0.1" } futures = { version = "^0.3" } futures-util = { version = "^0.3" } rocket = { git = "https://github.com/SergioBenitez/Rocket.git", features = [ diff --git a/examples/rocket_example/src/main.rs b/examples/rocket_example/src/main.rs index 8dd92fca..b5b60b4b 100644 --- a/examples/rocket_example/src/main.rs +++ b/examples/rocket_example/src/main.rs @@ -12,7 +12,9 @@ use rocket_dyn_templates::{context, Template}; use sea_orm::entity::*; use sea_orm::QueryOrder; -use sea_orm::RocketDbPool; + +mod pool; +use pool::RocketDbPool; mod setup; diff --git a/src/driver/rocket_db.rs b/examples/rocket_example/src/pool.rs similarity index 78% rename from src/driver/rocket_db.rs rename to examples/rocket_example/src/pool.rs index 5489e051..094746ba 100644 --- a/src/driver/rocket_db.rs +++ b/examples/rocket_example/src/pool.rs @@ -8,9 +8,9 @@ pub struct RocketDbPool { #[async_trait] impl rocket_db_pools::Pool for RocketDbPool { - type Error = crate::DbErr; + type Error = sea_orm::DbErr; - type Connection = crate::DatabaseConnection; + type Connection = sea_orm::DatabaseConnection; async fn init(figment: &Figment) -> Result { let config = figment.extract::().unwrap(); @@ -22,6 +22,6 @@ impl rocket_db_pools::Pool for RocketDbPool { } async fn get(&self) -> Result { - Ok(crate::Database::connect(&self.db_url).await.unwrap()) + Ok(sea_orm::Database::connect(&self.db_url).await.unwrap()) } } diff --git a/src/driver/mod.rs b/src/driver/mod.rs index 66ea7c79..6f6cfb64 100644 --- a/src/driver/mod.rs +++ b/src/driver/mod.rs @@ -19,8 +19,3 @@ pub use sqlx_mysql::*; pub use sqlx_postgres::*; #[cfg(feature = "sqlx-sqlite")] pub use sqlx_sqlite::*; - -#[cfg(feature = "web-api-rocket")] -mod rocket_db; -#[cfg(feature = "web-api-rocket")] -pub use rocket_db::*;