aboutsummaryrefslogtreecommitdiff
path: root/src/db/backend/sqlite.rs
blob: 002d0d32557ef497f1e200a352cfb752781057a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use diesel::connection::Connection as _;

pub use barrel::backend::Sqlite as SqlGenerator;
pub use diesel::sqlite::SqliteConnection as Connection;

pub struct Database {
    pub db_file: &'static str,
}

impl Database {
    pub fn connect(&self) -> diesel::ConnectionResult<Connection> {
        Connection::establish(self.db_file)
    }
}

impl Default for Database {
    fn default() -> Self {
        Self {
            db_file: "db.sqlite3",
        }
    }
}