summaryrefslogtreecommitdiff
path: root/src/db.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-03-13 10:17:02 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-03-13 10:17:02 +0100
commit44a35e651741afb6c417da47d636e4380cdd225f (patch)
tree72302a7bea06350b1e7175a6dddb08daebbbb135 /src/db.rs
parent48a9ac895b6e8b01622810ec4bf2f3a423426ca3 (diff)
feat: add get all repos from db
Diffstat (limited to 'src/db.rs')
-rw-r--r--src/db.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/db.rs b/src/db.rs
new file mode 100644
index 0000000..f547ab2
--- /dev/null
+++ b/src/db.rs
@@ -0,0 +1,8 @@
+use crate::errors::AppError;
+use deadpool_postgres::{Client, Pool, PoolError};
+
+pub async fn get_client(pool: Pool) -> Result<Client, AppError> {
+ pool.get()
+ .await
+ .map_err(|err: PoolError| AppError::from(err))
+}