pub struct GenericRepository<E: Entity> { /* private fields */ }Implementations§
Source§impl<E: Entity> GenericRepository<E>
impl<E: Entity> GenericRepository<E>
pub const fn new(pool: Arc<PgPool>) -> Self
pub fn pool(&self) -> &PgPool
pub async fn get(&self, id: &E::Id) -> Result<Option<E>, Error>
pub async fn list(&self, limit: i64, offset: i64) -> Result<Vec<E>, Error>
pub async fn list_all(&self) -> Result<Vec<E>, Error>
pub async fn delete(&self, id: &E::Id) -> Result<bool, Error>
pub async fn exists(&self, id: &E::Id) -> Result<bool, Error>
pub async fn count(&self) -> Result<i64, Error>
Trait Implementations§
Source§impl<E: Clone + Entity> Clone for GenericRepository<E>
impl<E: Clone + Entity> Clone for GenericRepository<E>
Source§fn clone(&self) -> GenericRepository<E>
fn clone(&self) -> GenericRepository<E>
Returns a duplicate 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<E: Entity> Debug for GenericRepository<E>
impl<E: Entity> Debug for GenericRepository<E>
Source§impl<E: Entity> RepositoryExt<E> for GenericRepository<E>
impl<E: Entity> RepositoryExt<E> for GenericRepository<E>
fn pool(&self) -> &PgPool
fn find_by<'life0, 'life1, 'async_trait, T>( &'life0 self, column: &'life1 str, value: T, ) -> Pin<Box<dyn Future<Output = Result<Option<E>, Error>> + Send + 'async_trait>>
fn find_all_by<'life0, 'life1, 'async_trait, T>( &'life0 self, column: &'life1 str, value: T, ) -> Pin<Box<dyn Future<Output = Result<Vec<E>, Error>> + Send + 'async_trait>>
Auto Trait Implementations§
impl<E> Freeze for GenericRepository<E>
impl<E> !RefUnwindSafe for GenericRepository<E>
impl<E> Send for GenericRepository<E>
impl<E> Sync for GenericRepository<E>
impl<E> Unpin for GenericRepository<E>
impl<E> !UnwindSafe for GenericRepository<E>
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§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