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

source

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

pub fn boxed(self) -> BoxRepository

Transform the repository into a type-erased [BoxRepository]

source§

impl<C> PgRepository<C>

source

pub fn from_conn(conn: C) -> Self

Create a new PgRepository from an existing PostgreSQL connection with a transaction

source

pub fn into_inner(self) -> C

Consume this PgRepository, returning the underlying connection.

Trait Implementations§

source§

impl<C> AsMut<C> for PgRepository<C>

source§

fn as_mut(&mut self) -> &mut C

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<C> AsRef<C> for PgRepository<C>

source§

fn as_ref(&self) -> &C

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<C> Deref for PgRepository<C>

source§

type Target = C

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<C> DerefMut for PgRepository<C>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<C> RepositoryAccess for PgRepository<C>
where C: AsMut<PgConnection> + Send,

source§

type Error = DatabaseError

The backend-specific error type used by each repository.
Get an [UpstreamOAuthLinkRepository]
source§

fn upstream_oauth_provider<'c>( &'c mut self, ) -> Box<dyn UpstreamOAuthProviderRepository<Error = Self::Error> + 'c>

Get an [UpstreamOAuthProviderRepository]
source§

fn upstream_oauth_session<'c>( &'c mut self, ) -> Box<dyn UpstreamOAuthSessionRepository<Error = Self::Error> + 'c>

Get an [UpstreamOAuthSessionRepository]
source§

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>

Get an [UserEmailRepository]
source§

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>

Get an [UserRecoveryRepository]
source§

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>

Get a [BrowserSessionRepository]
source§

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>

Get an [OAuth2ClientRepository]
source§

fn oauth2_authorization_grant<'c>( &'c mut self, ) -> Box<dyn OAuth2AuthorizationGrantRepository<Error = Self::Error> + 'c>

Get an [OAuth2AuthorizationGrantRepository]
source§

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>

Get an [OAuth2AccessTokenRepository]
source§

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>

Get an [OAuth2DeviceCodeGrantRepository]
source§

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>

Get a [CompatSsoLoginRepository]
source§

fn compat_access_token<'c>( &'c mut self, ) -> Box<dyn CompatAccessTokenRepository<Error = Self::Error> + 'c>

Get a [CompatAccessTokenRepository]
source§

fn compat_refresh_token<'c>( &'c mut self, ) -> Box<dyn CompatRefreshTokenRepository<Error = Self::Error> + 'c>

Get a [CompatRefreshTokenRepository]
source§

fn job<'c>(&'c mut self) -> Box<dyn JobRepository<Error = Self::Error> + 'c>

Get a [JobRepository]
source§

impl RepositoryTransaction for PgRepository

source§

type Error = DatabaseError

The error type used by the [Self::save] and [Self::cancel] functions
source§

fn save(self: Box<Self>) -> BoxFuture<'static, Result<(), Self::Error>>

Commit the transaction Read more
source§

fn cancel(self: Box<Self>) -> BoxFuture<'static, Result<(), Self::Error>>

Rollback the transaction Read more
source§

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> UnwindSafe for PgRepository<C>
where C: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more