From c6eab182f6d25e56a63993609254a5e1cbec4d96 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 May 2024 18:20:12 +0600 Subject: [PATCH] new crud repo extensions on* --- CHANGELOG.md | 1 + .../inmo/micro_utils/repos/StandartCRUDRepo.kt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f078fb94c11..32e85587991 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * `Common`: * All `Repo`s get `diff` extensions * `KeyValueRepo` and `KeyValuesRepo` get `applyDiff` extension + * Add new extensions `on*` flows for crud repos ## 0.20.48 diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt index 8ea1b8e8f92..28a9b94983f 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt @@ -42,6 +42,22 @@ interface WriteCRUDRepo : Repo { } typealias WriteStandardCRUDRepo = WriteCRUDRepo +/** + * Just mirroring [WriteCRUDRepo.newObjectsFlow] to be same as in KV repos + */ +val WriteCRUDRepo.onNewObjects: Flow + get() = newObjectsFlow +/** + * Just mirroring [WriteCRUDRepo.updatedObjectsFlow] to be same as in KV repos + */ +val WriteCRUDRepo.onUpdatedObjects: Flow + get() = updatedObjectsFlow +/** + * Just mirroring [WriteCRUDRepo.deletedObjectsIdsFlow] to be same as in KV repos + */ +val WriteCRUDRepo<*, IdType, *>.onDeletedObjectsIds: Flow + get() = deletedObjectsIdsFlow + suspend fun WriteCRUDRepo.create( vararg values: InputValueType ): List = create(values.toList())