Skip to content

Commit ee7f1bf

Browse files
committed
feat: expose raw_connection in PostgresClient
1 parent f51f432 commit ee7f1bf

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/database/postgres/client.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{env, future::Future, time::Duration};
22

3-
use bb8::{Pool, RunError};
3+
use bb8::{Pool, PooledConnection, RunError};
44
use bb8_postgres::PostgresConnectionManager;
55
use bytes::Buf;
66
use dotenv::dotenv;
@@ -424,4 +424,13 @@ impl PostgresClient {
424424
.map_err(|e| e.to_string())
425425
}
426426
}
427+
428+
pub async fn raw_connection(
429+
&self,
430+
) -> Result<PooledConnection<'_, PostgresConnectionManager<MakeTlsConnector>>, PostgresError>
431+
{
432+
let conn = self.pool.get().await?;
433+
434+
Ok(conn)
435+
}
427436
}

documentation/docs/pages/docs/changelog.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
### Features
77
-------------------------------------------------
8+
- feat: expose PostgresClient::raw_connection so its easier to do transactions
89

910
### Bug fixes
1011
-------------------------------------------------

0 commit comments

Comments
 (0)