aboutsummaryrefslogtreecommitdiff
path: root/src/db/backend.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-06-29 22:44:11 -0600
committerMelody Horn <melody@boringcactus.com>2021-06-29 22:44:11 -0600
commit9829bbfcd57c57e237c6aacb96a78d0b9f5bab68 (patch)
tree43dc643d7b592d9abc4c5f89121e249ccb597d7d /src/db/backend.rs
parent9dd7f2256a82f95096d928aaef70d15603152ebc (diff)
downloadtosin-9829bbfcd57c57e237c6aacb96a78d0b9f5bab68.tar.gz
tosin-9829bbfcd57c57e237c6aacb96a78d0b9f5bab68.zip
lol no generics
Diffstat (limited to 'src/db/backend.rs')
-rw-r--r--src/db/backend.rs27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/db/backend.rs b/src/db/backend.rs
deleted file mode 100644
index 5950747..0000000
--- a/src/db/backend.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-use barrel::backend::SqlGenerator;
-pub use diesel::connection::Connection;
-
-pub trait UsableBackend: diesel::backend::Backend where *const str: diesel::deserialize::FromSql<diesel::sql_types::Text, Self> {}
-impl UsableBackend for diesel::sqlite::Sqlite {}
-
-pub trait UsableConnection: Connection where <Self as Connection>::Backend: UsableBackend {}
-impl UsableConnection for diesel::sqlite::SqliteConnection {}
-
-pub trait Connectable {
- type Connection: UsableConnection;
- type SqlGenerator: SqlGenerator;
- fn connect(&self) -> diesel::ConnectionResult<Self::Connection>;
-}
-
-pub struct Sqlite {
- pub db_file: &'static str,
-}
-
-impl Connectable for Sqlite {
- type Connection = diesel::sqlite::SqliteConnection;
- type SqlGenerator = barrel::backend::Sqlite;
-
- fn connect(&self) -> diesel::ConnectionResult<Self::Connection> {
- Self::Connection::establish(self.db_file)
- }
-}