Repos¶
Repositories in this library are unified interfaces to work with different types of standard repos:
- CRUD (create/read/update/delete)
- Key-value
- Key-values
CRUD¶
Default interface for any CRUD-oriented realization of repositories. This type of repos separated to three interfaces:
CRUDRepo extends both ReadCRUDRepo and WriteCRUDRepo.
CRUD repos do not support forced placing of data by id when data is not in repo. That means, that you can’t set data in repo by id which absent in the repository.
ReadCRUDRepo¶
Contains read-only operations, such as getById, contains. This interface can’t be observed because of it does not suppose any mutable operation.
WriteCRUDRepo¶
Contains write-only operations, such as create, update. This interface can be observed via its flows:
- newObjectsFlow for newely created objects
- updatedObjectsFlow for old updated objects
- deletedObjectsIdsFlow for deleted objects
Info
By default, all mutating operations consumes Lists of data (List<New> for create, List<Pair<Id, New>> for update and List<Id> for delete),
but all they have their extension function-variations with one/two args (like create with New arg)
create operation consumes list of New variants of object and produces Registereds list. In most cases, Registered variant of object should have
Id of registered object, but it is not required for repo.
update operation consumes list of pairs with Id and New objects and produces list of Registered objects.
deleteById operation consumes list of Ids and do not consume anything except of notifying via deletedObjectsIdsFlow.