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>
Source§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
UpstreamOAuthLinkRepositorySource§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
UserRepositorySource§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
UserEmailRepositorySource§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
UserPasswordRepositorySource§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
UserRecoveryRepositorySource§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
UserTermsRepositorySource§fn user_registration<'c>(
&'c mut self,
) -> Box<dyn UserRegistrationRepository<Error = Self::Error> + 'c>
fn user_registration<'c>( &'c mut self, ) -> Box<dyn UserRegistrationRepository<Error = Self::Error> + 'c>
Get an
UserRegistrationRepositorySource§fn user_registration_token<'c>(
&'c mut self,
) -> Box<dyn UserRegistrationTokenRepository<Error = Self::Error> + 'c>
fn user_registration_token<'c>( &'c mut self, ) -> Box<dyn UserRegistrationTokenRepository<Error = Self::Error> + 'c>
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
BrowserSessionRepositorySource§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
AppSessionRepositorySource§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
OAuth2ClientRepositorySource§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
OAuth2SessionRepositorySource§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
OAuth2AccessTokenRepositorySource§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
OAuth2RefreshTokenRepositorySource§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
CompatSessionRepositorySource§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
CompatSsoLoginRepositorySource§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 queue_worker<'c>(
&'c mut self,
) -> Box<dyn QueueWorkerRepository<Error = Self::Error> + 'c>
fn queue_worker<'c>( &'c mut self, ) -> Box<dyn QueueWorkerRepository<Error = Self::Error> + 'c>
Get a
QueueWorkerRepositorySource§fn queue_job<'c>(
&'c mut self,
) -> Box<dyn QueueJobRepository<Error = Self::Error> + 'c>
fn queue_job<'c>( &'c mut self, ) -> Box<dyn QueueJobRepository<Error = Self::Error> + 'c>
Get a
QueueJobRepositorySource§fn queue_schedule<'c>(
&'c mut self,
) -> Box<dyn QueueScheduleRepository<Error = Self::Error> + 'c>
fn queue_schedule<'c>( &'c mut self, ) -> Box<dyn QueueScheduleRepository<Error = Self::Error> + 'c>
Get a
QueueScheduleRepositorySource§fn policy_data<'c>(
&'c mut self,
) -> Box<dyn PolicyDataRepository<Error = Self::Error> + 'c>
fn policy_data<'c>( &'c mut self, ) -> Box<dyn PolicyDataRepository<Error = Self::Error> + 'c>
Get a
PolicyDataRepositorySource§impl RepositoryTransaction for PgRepository
impl RepositoryTransaction for PgRepository
Source§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