mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 20:23:43 +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
|
||||
#[derive(
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
Debug,
|
||||
Clone,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Default,
|
||||
Queryable,
|
||||
AsExpression,
|
||||
serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Default, AsExpression,
|
||||
)]
|
||||
#[diesel(sql_type = diesel::sql_types::Text)]
|
||||
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
|
||||
where
|
||||
DB: Backend,
|
||||
|
||||
Reference in New Issue
Block a user