From 8852f0b7090c612f1d04a60becb55bbe56441eda Mon Sep 17 00:00:00 2001 From: Melody Horn / boringcactus Date: Wed, 23 Jun 2021 21:07:56 -0600 Subject: start impling diesel::Queryable for Models --- src/db/backend.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/db') 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 {} +impl UsableBackend for diesel::sqlite::Sqlite {} + +pub trait UsableConnection: Connection where ::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; } -- cgit v1.2.3