aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMelody Horn / boringcactus <melody@boringcactus.com>2021-06-23 21:07:56 -0600
committerMelody Horn / boringcactus <melody@boringcactus.com>2021-06-23 21:07:56 -0600
commit8852f0b7090c612f1d04a60becb55bbe56441eda (patch)
treef9fe2c8d3782ad2c09bb9fa4171ecb0653cc92b0 /src
parent88d527d574567420d7aa72f37205bd6b345b8dd7 (diff)
downloadtosin-8852f0b7090c612f1d04a60becb55bbe56441eda.tar.gz
tosin-8852f0b7090c612f1d04a60becb55bbe56441eda.zip
start impling diesel::Queryable for Models
Diffstat (limited to 'src')
-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>;
}