1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
mod users; use sqlx::{Pool, Postgres}; use self::users::Users; #[derive(Clone)] pub struct Database(Pool<Postgres>); impl Database { pub fn new(pool: Pool<Postgres>) -> Self { Self(pool) } pub fn users(&self) -> Users { Users::new(self.0.clone()) } }