[][src]Trait aragog::Record

pub trait Record {
    fn collection_name() -> &'static str;

#[must_use]    fn find<'life0, 'life1, 'async_trait>(
        key: &'life0 str,
        db_pool: &'life1 DatabaseConnectionPool
    ) -> Pin<Box<dyn Future<Output = Result<DatabaseRecord<Self>, ServiceError>> + Send + 'async_trait>>
    where
        Self: DeserializeOwned + Serialize + Clone,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: Send + 'async_trait
, { ... }
#[must_use] fn find_where<'life0, 'async_trait>(
        query: Query,
        db_pool: &'life0 DatabaseConnectionPool
    ) -> Pin<Box<dyn Future<Output = Result<DatabaseRecord<Self>, ServiceError>> + Send + 'async_trait>>
    where
        Self: DeserializeOwned + Serialize + Clone,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
#[must_use] fn get_where<'life0, 'async_trait>(
        query: Query,
        db_pool: &'life0 DatabaseConnectionPool
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DatabaseRecord<Self>>, ServiceError>> + Send + 'async_trait>>
    where
        Self: DeserializeOwned + Serialize + Clone,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... }
#[must_use] fn exists_where<'life0, 'async_trait>(
        query: Query,
        db_pool: &'life0 DatabaseConnectionPool
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
    where
        Self: DeserializeOwned + Serialize + Clone,
        'life0: 'async_trait,
        Self: Send + 'async_trait
, { ... } }

The main trait of the Aragog library. Trait for structures that can be stored in Database. The trait must be implemented to be used as a record in DatabaseRecord

Required methods

fn collection_name() -> &'static str

returns the associated Collection for read and write operations.

Loading content...

Provided methods

#[must_use]fn find<'life0, 'life1, 'async_trait>(
    key: &'life0 str,
    db_pool: &'life1 DatabaseConnectionPool
) -> Pin<Box<dyn Future<Output = Result<DatabaseRecord<Self>, ServiceError>> + Send + 'async_trait>> where
    Self: DeserializeOwned + Serialize + Clone,
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: Send + 'async_trait, 

Finds a document in database from its unique key. Simple wrapper for DatabaseRecord<T>::find

#[must_use]fn find_where<'life0, 'async_trait>(
    query: Query,
    db_pool: &'life0 DatabaseConnectionPool
) -> Pin<Box<dyn Future<Output = Result<DatabaseRecord<Self>, ServiceError>> + Send + 'async_trait>> where
    Self: DeserializeOwned + Serialize + Clone,
    'life0: 'async_trait,
    Self: Send + 'async_trait, 

Finds a document in database matching a Query. Simple wrapper for DatabaseRecord<T>::find_where

#[must_use]fn get_where<'life0, 'async_trait>(
    query: Query,
    db_pool: &'life0 DatabaseConnectionPool
) -> Pin<Box<dyn Future<Output = Result<Vec<DatabaseRecord<Self>>, ServiceError>> + Send + 'async_trait>> where
    Self: DeserializeOwned + Serialize + Clone,
    'life0: 'async_trait,
    Self: Send + 'async_trait, 

Finds all documents in database matching a Query. Simple wrapper for DatabaseRecord<T>::get_where

#[must_use]fn exists_where<'life0, 'async_trait>(
    query: Query,
    db_pool: &'life0 DatabaseConnectionPool
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where
    Self: DeserializeOwned + Serialize + Clone,
    'life0: 'async_trait,
    Self: Send + 'async_trait, 

Returns true if there are any document in database matching a Query. Simple wrapper for DatabaseRecord<T>::exists_where

Loading content...

Implementors

Loading content...