use anyhow::Result; use sqlx::{Pool, Postgres, postgres::PgPoolOptions}; pub mod auth; pub mod tables; pub type CurrDb = Postgres; pub type CurrPool = Pool; #[derive(Debug, Clone)] pub struct Database { pool: CurrPool, } impl Database { pub async fn connect() -> Result { let url = "postgres://postgres:postgres@127.0.0.1:5432/persmgr"; let pool = PgPoolOptions::new().connect(url).await?; Ok(Self { pool }) } pub fn pool(&self) -> &CurrPool { &self.pool } }