pub struct PgAuthAccountRepository<Id: IdType> { /* private fields */ }
Implementations§
source§impl<Id: IdType> PgAuthAccountRepository<Id>
impl<Id: IdType> PgAuthAccountRepository<Id>
pub fn new(id_generator: Arc<dyn PostgresIdGenerator<Id>>) -> Self
Methods from Deref<Target = SqlxPgC3p0Json<Id, AuthAccountData, AuthAccountDataCodec>>§
pub fn queries(&self) -> &Queries
sourcepub fn query_with_id<'a>(
&self,
sql: &'a str,
id: &'a Id,
) -> Query<'a, Postgres, <Postgres as Database>::Arguments<'a>>
pub fn query_with_id<'a>( &self, sql: &'a str, id: &'a Id, ) -> Query<'a, Postgres, <Postgres as Database>::Arguments<'a>>
Builds a query and binds the id to the first positional parameter
pub fn to_model(&self, row: &PgRow) -> Result<Model<Id, Data>, C3p0Error>
sourcepub async fn fetch_one_optional_with_sql<'a, A>(
&self,
tx: &mut PgTx,
sql: Query<'a, Postgres, A>,
) -> Result<Option<Model<Id, Data>>, C3p0Error>
pub async fn fetch_one_optional_with_sql<'a, A>( &self, tx: &mut PgTx, sql: Query<'a, Postgres, A>, ) -> Result<Option<Model<Id, Data>>, C3p0Error>
Allows the execution of a custom sql query and returns the first entry in the result set. For this to work, the sql query:
- must be a SELECT
- must declare the ID, VERSION and Data fields in this exact order
sourcepub async fn fetch_one_with_sql<'a, A>(
&self,
tx: &mut PgTx,
sql: Query<'a, Postgres, A>,
) -> Result<Model<Id, Data>, C3p0Error>
pub async fn fetch_one_with_sql<'a, A>( &self, tx: &mut PgTx, sql: Query<'a, Postgres, A>, ) -> Result<Model<Id, Data>, C3p0Error>
Allows the execution of a custom sql query and returns the first entry in the result set. For this to work, the sql query:
- must be a SELECT
- must declare the ID, VERSION and Data fields in this exact order
sourcepub async fn fetch_all_with_sql<'a, A>(
&self,
tx: &mut PgTx,
sql: Query<'a, Postgres, A>,
) -> Result<Vec<Model<Id, Data>>, C3p0Error>
pub async fn fetch_all_with_sql<'a, A>( &self, tx: &mut PgTx, sql: Query<'a, Postgres, A>, ) -> Result<Vec<Model<Id, Data>>, C3p0Error>
Allows the execution of a custom sql query and returns all the entries in the result set. For this to work, the sql query:
- must be a SELECT
- must declare the ID, VERSION and Data fields in this exact order
Trait Implementations§
source§impl<Id: IdType> AuthAccountRepository<Id> for PgAuthAccountRepository<Id>
impl<Id: IdType> AuthAccountRepository<Id> for PgAuthAccountRepository<Id>
type Tx = PgTx
async fn fetch_all_by_status( &self, tx: &mut Self::Tx, status: AuthAccountStatus, start_user_id: &Id, limit: u32, ) -> Result<Vec<AuthAccountModel<Id>>, LsError>
async fn fetch_by_id( &self, tx: &mut Self::Tx, user_id: &Id, ) -> Result<Model<Id, AuthAccountData>, LsError>
async fn fetch_by_username( &self, tx: &mut Self::Tx, username: &str, ) -> Result<AuthAccountModel<Id>, LsError>
async fn fetch_by_username_optional( &self, tx: &mut Self::Tx, username: &str, ) -> Result<Option<Model<Id, AuthAccountData>>, LsError>
async fn fetch_by_email_optional( &self, tx: &mut Self::Tx, email: &str, ) -> Result<Option<AuthAccountModel<Id>>, LsError>
async fn save( &self, tx: &mut Self::Tx, model: NewModel<AuthAccountData>, ) -> Result<Model<Id, AuthAccountData>, LsError>
async fn update( &self, tx: &mut Self::Tx, model: Model<Id, AuthAccountData>, ) -> Result<Model<Id, AuthAccountData>, LsError>
async fn delete( &self, tx: &mut Self::Tx, model: Model<Id, AuthAccountData>, ) -> Result<Model<Id, AuthAccountData>, LsError>
async fn delete_by_id( &self, tx: &mut Self::Tx, user_id: &Id, ) -> Result<u64, LsError>
source§impl<Id: Clone + IdType> Clone for PgAuthAccountRepository<Id>
impl<Id: Clone + IdType> Clone for PgAuthAccountRepository<Id>
source§fn clone(&self) -> PgAuthAccountRepository<Id>
fn clone(&self) -> PgAuthAccountRepository<Id>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Id: IdType> Deref for PgAuthAccountRepository<Id>
impl<Id: IdType> Deref for PgAuthAccountRepository<Id>
§type Target = SqlxPgC3p0Json<Id, AuthAccountData, AuthAccountDataCodec>
type Target = SqlxPgC3p0Json<Id, AuthAccountData, AuthAccountDataCodec>
The resulting type after dereferencing.
Auto Trait Implementations§
impl<Id> Freeze for PgAuthAccountRepository<Id>
impl<Id> !RefUnwindSafe for PgAuthAccountRepository<Id>
impl<Id> Send for PgAuthAccountRepository<Id>
impl<Id> Sync for PgAuthAccountRepository<Id>
impl<Id> Unpin for PgAuthAccountRepository<Id>
impl<Id> !UnwindSafe for PgAuthAccountRepository<Id>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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