mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-30 00:00:32 +02:00
Update to latest sqlx in example (#2099)
This commit is contained in:
@@ -41,7 +41,7 @@ async fn main() {
|
||||
// setup connection pool
|
||||
let pool = PgPoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect_timeout(Duration::from_secs(3))
|
||||
.acquire_timeout(Duration::from_secs(3))
|
||||
.connect(&db_connection_str)
|
||||
.await
|
||||
.expect("can't connect to database");
|
||||
@@ -95,11 +95,10 @@ where
|
||||
}
|
||||
|
||||
async fn using_connection_extractor(
|
||||
DatabaseConnection(conn): DatabaseConnection,
|
||||
DatabaseConnection(mut conn): DatabaseConnection,
|
||||
) -> Result<String, (StatusCode, String)> {
|
||||
let mut conn = conn;
|
||||
sqlx::query_scalar("select 'hello world from pg'")
|
||||
.fetch_one(&mut conn)
|
||||
.fetch_one(&mut *conn)
|
||||
.await
|
||||
.map_err(internal_error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user