summaryrefslogtreecommitdiff
path: root/src/db.rs
blob: 5367288d5ac8db092d4b6939bf3ea7eab1e6fe9d (plain)
1
2
3
4
5
6
7
8
9
use crate::errors::AppError;
use deadpool_postgres::{Client, Pool, PoolError};

/// Return a valid `Client` to make SQL queries
pub async fn get_client(pool: Pool) -> Result<Client, AppError> {
    pool.get()
        .await
        .map_err(|err: PoolError| AppError::from(err))
}