blob: b75d5caf932f120989c1c974dccdc0aea4987cd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
pub use diesel::connection::Connection;
pub trait Connectable {
type Connection: Connection;
fn connect(&self) -> diesel::ConnectionResult<Self::Connection>;
}
pub struct Sqlite {
pub db_file: &'static str,
}
impl Connectable for Sqlite {
type Connection = diesel::sqlite::SqliteConnection;
fn connect(&self) -> diesel::ConnectionResult<Self::Connection> {
Self::Connection::establish(self.db_file)
}
}
|