Skip to content

Commit 22a2efc

Browse files
committed
Allow creating a sea_orm::Database from sqlx::ConnectOptions
1 parent ee2afc4 commit 22a2efc

File tree

8 files changed

+322
-84
lines changed

8 files changed

+322
-84
lines changed

Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal", "sea-query-b
8080
with-bigdecimal = ["bigdecimal", "sea-query/with-bigdecimal", "sea-query-binder?/with-bigdecimal", "sqlx?/bigdecimal"]
8181
with-uuid = ["uuid", "sea-query/with-uuid", "sea-query-binder?/with-uuid", "sqlx?/uuid"]
8282
with-time = ["time", "sea-query/with-time", "sea-query-binder?/with-time", "sqlx?/time"]
83-
postgres-array = ["sea-query/postgres-array", "sea-query-binder?/postgres-array", "sea-orm-macros?/postgres-array"]
83+
postgres-array = ["sea-query/postgres-array", "sea-query-binder?/postgres-array", "sea-orm-macros?/postgres-array", "sqlx-any"]
8484
sqlx-dep = []
85-
sqlx-all = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite"]
85+
sqlx-all = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", "sqlx-any"]
8686
sqlx-mysql = ["sqlx-dep", "sea-query-binder/sqlx-mysql", "sqlx/mysql"]
87+
sqlx-any = ["sqlx-dep", "sqlx/any"]
8788
sqlx-postgres = ["sqlx-dep", "sea-query-binder/sqlx-postgres", "sqlx/postgres"]
8889
sqlx-sqlite = ["sqlx-dep", "sea-query-binder/sqlx-sqlite", "sqlx/sqlite"]
8990
runtime-async-std = []

examples/rocket_example/api/src/pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl sea_orm_rocket::Pool for SeaOrmPool {
2222

2323
async fn init(figment: &Figment) -> Result<Self, Self::Error> {
2424
let config = figment.extract::<Config>().unwrap();
25-
let mut options: ConnectOptions = config.url.into();
25+
let mut options: ConnectOptions = config.url.try_into()?;
2626
options
2727
.max_connections(config.max_connections as u32)
2828
.min_connections(config.min_connections.unwrap_or_default())

examples/rocket_okapi_example/api/src/pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl sea_orm_rocket::Pool for SeaOrmPool {
2222

2323
async fn init(figment: &Figment) -> Result<Self, Self::Error> {
2424
let config = figment.extract::<Config>().unwrap();
25-
let mut options: ConnectOptions = config.url.into();
25+
let mut options: ConnectOptions = config.url.try_into()?;
2626
options
2727
.max_connections(config.max_connections as u32)
2828
.min_connections(config.min_connections.unwrap_or_default())

0 commit comments

Comments
 (0)