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 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
👎Deprecated since 0.9.0: Renamed to
random to avoid conflict with the new gen keyword in Rust 2024.Alias for
Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
👎Deprecated since 0.9.0: Renamed to
random_rangeAlias for
Rng::random_range.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
Convert an
RngCore to a RngReadAdapter.