Struct lightspeed_auth::repository::pg::pg_token::PgTokenRepository
source · pub struct PgTokenRepository<Id: IdType> { /* private fields */ }
Implementations§
source§impl<Id: IdType> PgTokenRepository<Id>
impl<Id: IdType> PgTokenRepository<Id>
pub fn new(id_generator: Arc<dyn PostgresIdGenerator<Id>>) -> Self
Methods from Deref<Target = SqlxPgC3p0Json<Id, TokenData, TokenDataCodec>>§
pub fn queries(&self) -> &Queries
sourcepub fn query_with_id<'a>(
&self,
sql: &'a str,
id: &'a Id
) -> Query<'a, Postgres, <Postgres as HasArguments<'a>>::Arguments>
pub fn query_with_id<'a>( &self, sql: &'a str, id: &'a Id ) -> Query<'a, Postgres, <Postgres as HasArguments<'a>>::Arguments>
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: Clone + IdType> Clone for PgTokenRepository<Id>
impl<Id: Clone + IdType> Clone for PgTokenRepository<Id>
source§fn clone(&self) -> PgTokenRepository<Id>
fn clone(&self) -> PgTokenRepository<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 PgTokenRepository<Id>
impl<Id: IdType> Deref for PgTokenRepository<Id>
§type Target = SqlxPgC3p0Json<Id, TokenData, TokenDataCodec>
type Target = SqlxPgC3p0Json<Id, TokenData, TokenDataCodec>
The resulting type after dereferencing.
source§impl<Id: IdType> TokenRepository<Id> for PgTokenRepository<Id>
impl<Id: IdType> TokenRepository<Id> for PgTokenRepository<Id>
type Tx = PgTx
async fn fetch_by_token( &self, tx: &mut Self::Tx, token_string: &str ) -> Result<TokenModel<Id>, LsError>
async fn fetch_by_username( &self, tx: &mut Self::Tx, username: &str ) -> Result<Vec<TokenModel<Id>>, LsError>
async fn save( &self, tx: &mut Self::Tx, model: NewModel<TokenData> ) -> Result<Model<Id, TokenData>, LsError>
async fn delete( &self, tx: &mut Self::Tx, model: Model<Id, TokenData> ) -> Result<Model<Id, TokenData>, LsError>
Auto Trait Implementations§
impl<Id> Freeze for PgTokenRepository<Id>
impl<Id> !RefUnwindSafe for PgTokenRepository<Id>
impl<Id> Send for PgTokenRepository<Id>
impl<Id> Sync for PgTokenRepository<Id>
impl<Id> Unpin for PgTokenRepository<Id>
impl<Id> !UnwindSafe for PgTokenRepository<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