summaryrefslogtreecommitdiff
path: root/src/app.rs
blob: 4195fdca436e2863ace2716cba72a6bf5dd3733e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use sqlx::sqlite::SqlitePool;

use crate::{channel::app::Channels, index::app::Index, login::app::Logins};

#[derive(Clone)]
pub struct App {
    db: SqlitePool,
}

impl App {
    pub fn from(db: SqlitePool) -> Self {
        Self { db }
    }
}

impl App {
    pub fn index(&self) -> Index {
        Index::new(&self.db)
    }

    pub fn logins(&self) -> Logins {
        Logins::new(&self.db)
    }

    pub fn channels(&self) -> Channels {
        Channels::new(&self.db)
    }
}