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.
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
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>
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>
UpstreamOAuthProviderRepository]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>
UpstreamOAuthSessionRepository]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>
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>
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>
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>
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>
UserTermsRepository]Source§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>
UserRegistrationRepository]Source§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>
UserRegistrationTokenRepository]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>
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>
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>
OAuth2ClientRepository]OAuth2AuthorizationGrantRepository]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>
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>
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>
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>
OAuth2DeviceCodeGrantRepository]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>
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>
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>
CompatAccessTokenRepository]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>
CompatRefreshTokenRepository]Source§fn personal_access_token<'c>(
&'c mut self,
) -> Box<dyn PersonalAccessTokenRepository<Error = Self::Error> + 'c>
fn personal_access_token<'c>( &'c mut self, ) -> Box<dyn PersonalAccessTokenRepository<Error = Self::Error> + 'c>
PersonalAccessTokenRepository]Source§fn personal_session<'c>(
&'c mut self,
) -> Box<dyn PersonalSessionRepository<Error = Self::Error> + 'c>
fn personal_session<'c>( &'c mut self, ) -> Box<dyn PersonalSessionRepository<Error = Self::Error> + 'c>
PersonalSessionRepository]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>
QueueWorkerRepository]Source§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>
QueueJobRepository]Source§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>
QueueScheduleRepository]Source§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>
PolicyDataRepository]Source§impl RepositoryTransaction for PgRepository
impl RepositoryTransaction for PgRepository
impl 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> UnsafeUnpin for PgRepository<C>where
C: UnsafeUnpin,
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
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>
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>
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);