diff options
| author | 2023-12-12 18:20:56 +0000 | |
|---|---|---|
| committer | 2023-12-12 18:20:56 +0000 | |
| commit | a587459a1817c0fc57b46df3f9c69567e1e775b7 (patch) | |
| tree | ab99c6aaa7c2b3245c83db6332e4ca54006831b3 /src/db/mod.rs | |
| parent | 370a25e5a0cbb95e2aa1cec55305b22aeaf99aa0 (diff) | |
| download | pinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.tar.gz pinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.tar.bz2 pinussy-a587459a1817c0fc57b46df3f9c69567e1e775b7.zip | |
refactor: separate model and controller
Diffstat (limited to '')
| -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()) +    } +} | 
