mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
fix(common_utils): manually implement diesel queryable for email newtype (#1072)
This commit is contained in:
@ -117,19 +117,23 @@ where
|
|||||||
}
|
}
|
||||||
/// Email address
|
/// Email address
|
||||||
#[derive(
|
#[derive(
|
||||||
serde::Serialize,
|
serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Default, AsExpression,
|
||||||
serde::Deserialize,
|
|
||||||
Debug,
|
|
||||||
Clone,
|
|
||||||
PartialEq,
|
|
||||||
Eq,
|
|
||||||
Default,
|
|
||||||
Queryable,
|
|
||||||
AsExpression,
|
|
||||||
)]
|
)]
|
||||||
#[diesel(sql_type = diesel::sql_types::Text)]
|
#[diesel(sql_type = diesel::sql_types::Text)]
|
||||||
pub struct Email(Secret<String, EmailStrategy>);
|
pub struct Email(Secret<String, EmailStrategy>);
|
||||||
|
|
||||||
|
impl<DB> Queryable<diesel::sql_types::Text, DB> for Email
|
||||||
|
where
|
||||||
|
DB: Backend,
|
||||||
|
Self: FromSql<sql_types::Text, DB>,
|
||||||
|
{
|
||||||
|
type Row = Self;
|
||||||
|
|
||||||
|
fn build(row: Self::Row) -> deserialize::Result<Self> {
|
||||||
|
Ok(row)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<DB> FromSql<sql_types::Text, DB> for Email
|
impl<DB> FromSql<sql_types::Text, DB> for Email
|
||||||
where
|
where
|
||||||
DB: Backend,
|
DB: Backend,
|
||||||
|
|||||||
Reference in New Issue
Block a user