aboutsummaryrefslogtreecommitdiff
path: root/src/db/backend.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/backend.rs')
-rw-r--r--src/db/backend.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/db/backend.rs b/src/db/backend.rs
index 5f35dd9..5950747 100644
--- a/src/db/backend.rs
+++ b/src/db/backend.rs
@@ -1,8 +1,14 @@
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: Connection;
+ type Connection: UsableConnection;
type SqlGenerator: SqlGenerator;
fn connect(&self) -> diesel::ConnectionResult<Self::Connection>;
}