diff options
Diffstat (limited to 'src/db/mod.rs')
-rw-r--r-- | src/db/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/db/mod.rs b/src/db/mod.rs new file mode 100644 index 0000000..f010bf8 --- /dev/null +++ b/src/db/mod.rs @@ -0,0 +1,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()) + } +} |