pub trait WriteRepo: Sync {
type Entity: MutableEntity + Send + Sync;
// Required methods
fn add<'life0, 'async_trait>(
&'life0 self,
item: Self::Entity,
) -> Pin<Box<dyn Future<Output = RepoResult<Self::Entity>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update<'life0, 'async_trait>(
&'life0 self,
item: Self::Entity,
) -> Pin<Box<dyn Future<Output = RepoResult<Self::Entity>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 <Self::Entity as Entity>::Key,
) -> Pin<Box<dyn Future<Output = RepoResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A trait to add mutability operations to repositories.
Unlike Repo trait, implementations of this trait can have side effects
on the stored data, thus extra care needs to be taken when used.
Required Associated Types§
Sourcetype Entity: MutableEntity + Send + Sync
type Entity: MutableEntity + Send + Sync
The type of the entity that this repository operates on.
Required Methods§
Sourcefn add<'life0, 'async_trait>(
&'life0 self,
item: Self::Entity,
) -> Pin<Box<dyn Future<Output = RepoResult<Self::Entity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add<'life0, 'async_trait>(
&'life0 self,
item: Self::Entity,
) -> Pin<Box<dyn Future<Output = RepoResult<Self::Entity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn update<'life0, 'async_trait>(
&'life0 self,
item: Self::Entity,
) -> Pin<Box<dyn Future<Output = RepoResult<Self::Entity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update<'life0, 'async_trait>(
&'life0 self,
item: Self::Entity,
) -> Pin<Box<dyn Future<Output = RepoResult<Self::Entity>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Updates an item in the data repository.
The item must be present in the data repository, as implementations of this trait shall not create the item if it does not exist.
§Arguments
item- Item to be updated