summaryrefslogtreecommitdiff
path: root/src/db.rs
blob: f547ab287ebb49eda25eee7520edb5471af7ac51 (plain)
1
2
3
4
5
6
7
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))
}