[−][src]Trait aragog::Record
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.
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,
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_by<'life0, 'life1, 'async_trait>(
condition: &'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,
condition: &'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 matching a specific condition.
Simple wrapper for DatabaseRecord
<T
>::find_by
#[must_use]fn find_where<'life0, 'life1, 'async_trait>(
conditions: Vec<&'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,
conditions: Vec<&'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 matching a Vec of conditions.
Simple wrapper for DatabaseRecord
<T
>::find_where
#[must_use]fn get_where<'life0, 'life1, 'async_trait>(
conditions: Vec<&'life0 str>,
db_pool: &'life1 DatabaseConnectionPool
) -> Pin<Box<dyn Future<Output = Result<Vec<DatabaseRecord<Self>>, ServiceError>> + Send + 'async_trait>> where
Self: DeserializeOwned + Serialize + Clone,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
conditions: Vec<&'life0 str>,
db_pool: &'life1 DatabaseConnectionPool
) -> Pin<Box<dyn Future<Output = Result<Vec<DatabaseRecord<Self>>, ServiceError>> + Send + 'async_trait>> where
Self: DeserializeOwned + Serialize + Clone,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
Finds all documents in database matching a Vec of conditions.
Simple wrapper for DatabaseRecord
<T
>::get_where
#[must_use]fn exists_where<'life0, 'life1, 'async_trait>(
conditions: Vec<&'life0 str>,
db_pool: &'life1 DatabaseConnectionPool
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where
Self: DeserializeOwned + Serialize + Clone,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
conditions: Vec<&'life0 str>,
db_pool: &'life1 DatabaseConnectionPool
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where
Self: DeserializeOwned + Serialize + Clone,
'life0: 'async_trait,
'life1: 'async_trait,
Self: Send + 'async_trait,
Returns true if there are any document in database matching a Vec of conditions.
Simple wrapper for DatabaseRecord
<T
>::exists_where