use sqlx::{PgPool};
use anyhow::*;
use sqlx::postgres::PgPoolOptions;
 
#[derive(Clone)]
pub struct DBApplication {
    pool: PgPool
}
 
impl DBApplication {
    pub async fn new(config: String) -> Result<DBApplication> {
        let pool = PgPoolOptions::new()
            .max_connections(5)
            .connect(&config)
            .await?;
        Ok(DBApplication { pool })
    }
}