Struct mas_storage_pg::PgRepository
source · pub struct PgRepository<C = Transaction<'static, Postgres>> { /* private fields */ }
Expand description
An implementation of the Repository
trait backed by a PostgreSQL
transaction.
Implementations§
source§impl PgRepository
impl PgRepository
sourcepub async fn from_pool(pool: &PgPool) -> Result<Self, DatabaseError>
pub async fn from_pool(pool: &PgPool) -> Result<Self, DatabaseError>
Create a new PgRepository
from a PostgreSQL connection pool,
starting a transaction.
§Errors
Returns a DatabaseError
if the transaction could not be started.
sourcepub fn boxed(self) -> BoxRepository
pub fn boxed(self) -> BoxRepository
Transform the repository into a type-erased BoxRepository
source§impl<C> PgRepository<C>
impl<C> PgRepository<C>
sourcepub fn from_conn(conn: C) -> Self
pub fn from_conn(conn: C) -> Self
Create a new PgRepository
from an existing PostgreSQL connection
with a transaction
sourcepub fn into_inner(self) -> C
pub fn into_inner(self) -> C
Consume this PgRepository
, returning the underlying connection.
Trait Implementations§
source§impl<C> AsMut<C> for PgRepository<C>
impl<C> AsMut<C> for PgRepository<C>
source§impl<C> AsRef<C> for PgRepository<C>
impl<C> AsRef<C> for PgRepository<C>
source§impl<C> Deref for PgRepository<C>
impl<C> Deref for PgRepository<C>
source§impl<C> DerefMut for PgRepository<C>
impl<C> DerefMut for PgRepository<C>
source§impl<C> RepositoryAccess for PgRepository<C>
impl<C> RepositoryAccess for PgRepository<C>
§type Error = DatabaseError
type Error = DatabaseError
The backend-specific error type used by each repository.
source§fn upstream_oauth_link<'c>(
&'c mut self,
) -> Box<dyn UpstreamOAuthLinkRepository<Error = Self::Error> + 'c>
fn upstream_oauth_link<'c>( &'c mut self, ) -> Box<dyn UpstreamOAuthLinkRepository<Error = Self::Error> + 'c>
Get an
UpstreamOAuthLinkRepository
source§fn upstream_oauth_provider<'c>(
&'c mut self,
) -> Box<dyn UpstreamOAuthProviderRepository<Error = Self::Error> + 'c>
fn upstream_oauth_provider<'c>( &'c mut self, ) -> Box<dyn UpstreamOAuthProviderRepository<Error = Self::Error> + 'c>
source§fn upstream_oauth_session<'c>(
&'c mut self,
) -> Box<dyn UpstreamOAuthSessionRepository<Error = Self::Error> + 'c>
fn upstream_oauth_session<'c>( &'c mut self, ) -> Box<dyn UpstreamOAuthSessionRepository<Error = Self::Error> + 'c>
source§fn user<'c>(&'c mut self) -> Box<dyn UserRepository<Error = Self::Error> + 'c>
fn user<'c>(&'c mut self) -> Box<dyn UserRepository<Error = Self::Error> + 'c>
Get an
UserRepository
source§fn user_email<'c>(
&'c mut self,
) -> Box<dyn UserEmailRepository<Error = Self::Error> + 'c>
fn user_email<'c>( &'c mut self, ) -> Box<dyn UserEmailRepository<Error = Self::Error> + 'c>
Get an
UserEmailRepository
source§fn user_password<'c>(
&'c mut self,
) -> Box<dyn UserPasswordRepository<Error = Self::Error> + 'c>
fn user_password<'c>( &'c mut self, ) -> Box<dyn UserPasswordRepository<Error = Self::Error> + 'c>
Get an
UserPasswordRepository
source§fn user_recovery<'c>(
&'c mut self,
) -> Box<dyn UserRecoveryRepository<Error = Self::Error> + 'c>
fn user_recovery<'c>( &'c mut self, ) -> Box<dyn UserRecoveryRepository<Error = Self::Error> + 'c>
Get an
UserRecoveryRepository
source§fn user_terms<'c>(
&'c mut self,
) -> Box<dyn UserTermsRepository<Error = Self::Error> + 'c>
fn user_terms<'c>( &'c mut self, ) -> Box<dyn UserTermsRepository<Error = Self::Error> + 'c>
Get an
UserTermsRepository
source§fn browser_session<'c>(
&'c mut self,
) -> Box<dyn BrowserSessionRepository<Error = Self::Error> + 'c>
fn browser_session<'c>( &'c mut self, ) -> Box<dyn BrowserSessionRepository<Error = Self::Error> + 'c>
Get a
BrowserSessionRepository
source§fn app_session<'c>(
&'c mut self,
) -> Box<dyn AppSessionRepository<Error = Self::Error> + 'c>
fn app_session<'c>( &'c mut self, ) -> Box<dyn AppSessionRepository<Error = Self::Error> + 'c>
Get a
AppSessionRepository
source§fn oauth2_client<'c>(
&'c mut self,
) -> Box<dyn OAuth2ClientRepository<Error = Self::Error> + 'c>
fn oauth2_client<'c>( &'c mut self, ) -> Box<dyn OAuth2ClientRepository<Error = Self::Error> + 'c>
Get an
OAuth2ClientRepository
source§fn oauth2_session<'c>(
&'c mut self,
) -> Box<dyn OAuth2SessionRepository<Error = Self::Error> + 'c>
fn oauth2_session<'c>( &'c mut self, ) -> Box<dyn OAuth2SessionRepository<Error = Self::Error> + 'c>
Get an
OAuth2SessionRepository
source§fn oauth2_access_token<'c>(
&'c mut self,
) -> Box<dyn OAuth2AccessTokenRepository<Error = Self::Error> + 'c>
fn oauth2_access_token<'c>( &'c mut self, ) -> Box<dyn OAuth2AccessTokenRepository<Error = Self::Error> + 'c>
Get an
OAuth2AccessTokenRepository
source§fn oauth2_refresh_token<'c>(
&'c mut self,
) -> Box<dyn OAuth2RefreshTokenRepository<Error = Self::Error> + 'c>
fn oauth2_refresh_token<'c>( &'c mut self, ) -> Box<dyn OAuth2RefreshTokenRepository<Error = Self::Error> + 'c>
Get an
OAuth2RefreshTokenRepository
source§fn oauth2_device_code_grant<'c>(
&'c mut self,
) -> Box<dyn OAuth2DeviceCodeGrantRepository<Error = Self::Error> + 'c>
fn oauth2_device_code_grant<'c>( &'c mut self, ) -> Box<dyn OAuth2DeviceCodeGrantRepository<Error = Self::Error> + 'c>
source§fn compat_session<'c>(
&'c mut self,
) -> Box<dyn CompatSessionRepository<Error = Self::Error> + 'c>
fn compat_session<'c>( &'c mut self, ) -> Box<dyn CompatSessionRepository<Error = Self::Error> + 'c>
Get a
CompatSessionRepository
source§fn compat_sso_login<'c>(
&'c mut self,
) -> Box<dyn CompatSsoLoginRepository<Error = Self::Error> + 'c>
fn compat_sso_login<'c>( &'c mut self, ) -> Box<dyn CompatSsoLoginRepository<Error = Self::Error> + 'c>
Get a
CompatSsoLoginRepository
source§fn compat_access_token<'c>(
&'c mut self,
) -> Box<dyn CompatAccessTokenRepository<Error = Self::Error> + 'c>
fn compat_access_token<'c>( &'c mut self, ) -> Box<dyn CompatAccessTokenRepository<Error = Self::Error> + 'c>
source§fn compat_refresh_token<'c>(
&'c mut self,
) -> Box<dyn CompatRefreshTokenRepository<Error = Self::Error> + 'c>
fn compat_refresh_token<'c>( &'c mut self, ) -> Box<dyn CompatRefreshTokenRepository<Error = Self::Error> + 'c>
source§fn job<'c>(&'c mut self) -> Box<dyn JobRepository<Error = Self::Error> + 'c>
fn job<'c>(&'c mut self) -> Box<dyn JobRepository<Error = Self::Error> + 'c>
Get a
JobRepository
source§impl RepositoryTransaction for PgRepository
impl RepositoryTransaction for PgRepository
§type Error = DatabaseError
type Error = DatabaseError
The error type used by the
Self::save
and Self::cancel
functionsimpl Repository<DatabaseError> for PgRepository
Auto Trait Implementations§
impl<C> Freeze for PgRepository<C>where
C: Freeze,
impl<C> RefUnwindSafe for PgRepository<C>where
C: RefUnwindSafe,
impl<C> Send for PgRepository<C>where
C: Send,
impl<C> Sync for PgRepository<C>where
C: Sync,
impl<C> Unpin for PgRepository<C>where
C: Unpin,
impl<C> UnwindSafe for PgRepository<C>where
C: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more