Impl SQL traits for SafeString only for the selected backend

Fixes #269
This commit is contained in:
Bat 2018-10-08 18:58:15 +01:00
parent 0469b8dae2
commit 4f84b2a3ed
2 changed files with 3 additions and 0 deletions

Binary file not shown.

View file

@ -85,6 +85,7 @@ impl<'de> Deserialize<'de> for SafeString {
} }
} }
#[cfg(all(feature = "postgres", not(feature = "sqlite")))]
impl Queryable<Text, diesel::pg::Pg> for SafeString { impl Queryable<Text, diesel::pg::Pg> for SafeString {
type Row = String; type Row = String;
fn build(value: Self::Row) -> Self { fn build(value: Self::Row) -> Self {
@ -92,6 +93,7 @@ impl Queryable<Text, diesel::pg::Pg> for SafeString {
} }
} }
#[cfg(all(feature = "sqlite", not(feature = "postgres")))]
impl Queryable<Text, diesel::sqlite::Sqlite> for SafeString { impl Queryable<Text, diesel::sqlite::Sqlite> for SafeString {
type Row = String; type Row = String;
fn build(value: Self::Row) -> Self { fn build(value: Self::Row) -> Self {
@ -99,6 +101,7 @@ impl Queryable<Text, diesel::sqlite::Sqlite> for SafeString {
} }
} }
impl<DB> ToSql<diesel::sql_types::Text, DB> for SafeString impl<DB> ToSql<diesel::sql_types::Text, DB> for SafeString
where where
DB: diesel::backend::Backend, DB: diesel::backend::Backend,