pub trait DeletableBySearchKey<'a, SearchKey: KeyType>: SearchableEntity<SearchKey> + EntityDatabaseMutation<'a> {
// Required method
fn delete_all_matching<'life0, 'life1, 'async_trait>(
tx: &'life0 Self::Transaction,
search_key: &'life1 SearchKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Entities implementing DeletableBySearchKey can be deleted by that search key.
This is a way at the type-system level to implement WHERE-clause deletion.
This trait can potentially be implemented multiple times per entity, in case there are a variety of interesting searches.
While the trait design does not require it, implementations should take advantage of database features such as indices to ensure that deletion by a search key is efficient.
Required Methods§
Sourcefn delete_all_matching<'life0, 'life1, 'async_trait>(
tx: &'life0 Self::Transaction,
search_key: &'life1 SearchKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_all_matching<'life0, 'life1, 'async_trait>(
tx: &'life0 Self::Transaction,
search_key: &'life1 SearchKey,
) -> Pin<Box<dyn Future<Output = CryptoKeystoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete all entities matching the search key.
The specific meaning of “matching” the search key will depend on the entity
in question, it should always have the same meaning for this implementation
and the equivalent SearchableEntity implementation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.