mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
enhancement(common_utils): impl deref for email newtype (#1073)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
//! Personal Identifiable Information protection.
|
//! Personal Identifiable Information protection.
|
||||||
|
|
||||||
use std::{convert::AsRef, fmt, str::FromStr};
|
use std::{convert::AsRef, fmt, ops, str::FromStr};
|
||||||
|
|
||||||
use diesel::{
|
use diesel::{
|
||||||
backend,
|
backend,
|
||||||
@ -122,6 +122,20 @@ where
|
|||||||
#[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 ops::Deref for Email {
|
||||||
|
type Target = Secret<String, EmailStrategy>;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ops::DerefMut for Email {
|
||||||
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
|
&mut self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<DB> Queryable<diesel::sql_types::Text, DB> for Email
|
impl<DB> Queryable<diesel::sql_types::Text, DB> for Email
|
||||||
where
|
where
|
||||||
DB: Backend,
|
DB: Backend,
|
||||||
|
|||||||
Reference in New Issue
Block a user