From f6ef5c61c521dedd9745b8714cca416f31958a0a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 11 Dec 2023 23:54:25 +0600 Subject: [PATCH 1/2] start 0.20.20 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51d353c7b35..0c17464ece5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.20.20 + ## 0.20.19 * `Versions`: diff --git a/gradle.properties b/gradle.properties index 8fe5448f0f5..e8f541ad0da 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,5 +15,5 @@ crypto_js_version=4.1.1 # Project data group=dev.inmo -version=0.20.19 -android_code_version=225 +version=0.20.20 +android_code_version=226 From 1afbf03606fbf699bfce3615af5e01f45884fa72 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 12 Dec 2023 00:01:58 +0600 Subject: [PATCH 2/2] improvements in AbstractExposedCRUDRepo --- CHANGELOG.md | 4 ++++ .../repos/exposed/AbstractExposedCRUDRepo.kt | 9 ++++++-- .../exposed/AbstractExposedWriteCRUDRepo.kt | 22 +++++++++++++------ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c17464ece5..afbdc4cbca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.20.20 +* `Repos`: + * `Exposed`: + * Add opportunity for setup flows in `AbstractExposedCRUDRepo` + ## 0.20.19 * `Versions`: diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedCRUDRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedCRUDRepo.kt index 11cb0154a2b..13d0b1ccb59 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedCRUDRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedCRUDRepo.kt @@ -1,14 +1,19 @@ package dev.inmo.micro_utils.repos.exposed import dev.inmo.micro_utils.repos.CRUDRepo +import kotlinx.coroutines.channels.BufferOverflow abstract class AbstractExposedCRUDRepo( flowsChannelsSize: Int = 0, - tableName: String = "" + tableName: String = "", + replyCacheInFlows: Int = 0, + onBufferOverflowBehaviour: BufferOverflow = BufferOverflow.SUSPEND ) : AbstractExposedWriteCRUDRepo( flowsChannelsSize, - tableName + tableName, + replyCacheInFlows, + onBufferOverflowBehaviour ), ExposedCRUDRepo, CRUDRepo diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt index 3639add9439..21823daa50f 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt @@ -2,6 +2,7 @@ package dev.inmo.micro_utils.repos.exposed import dev.inmo.micro_utils.repos.UpdatedValuePair import dev.inmo.micro_utils.repos.WriteCRUDRepo +import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.* import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.statements.* @@ -11,19 +12,26 @@ import java.util.Objects abstract class AbstractExposedWriteCRUDRepo( flowsChannelsSize: Int = 0, tableName: String = "", - replyCacheInFlows: Int = 0 + replyCacheInFlows: Int = 0, + onBufferOverflowBehaviour: BufferOverflow = BufferOverflow.SUSPEND ) : AbstractExposedReadCRUDRepo(tableName), ExposedCRUDRepo, WriteCRUDRepo { - protected val _newObjectsFlow = MutableSharedFlow(replyCacheInFlows, flowsChannelsSize) - protected val _updatedObjectsFlow = MutableSharedFlow(replyCacheInFlows, flowsChannelsSize) - protected val _deletedObjectsIdsFlow = MutableSharedFlow(replyCacheInFlows, flowsChannelsSize) + protected open val _newObjectsFlow = MutableSharedFlow(replyCacheInFlows, flowsChannelsSize, onBufferOverflowBehaviour) + protected open val _updatedObjectsFlow = MutableSharedFlow(replyCacheInFlows, flowsChannelsSize, onBufferOverflowBehaviour) + protected open val _deletedObjectsIdsFlow = MutableSharedFlow(replyCacheInFlows, flowsChannelsSize, onBufferOverflowBehaviour) - override val newObjectsFlow: Flow = _newObjectsFlow.asSharedFlow() - override val updatedObjectsFlow: Flow = _updatedObjectsFlow.asSharedFlow() - override val deletedObjectsIdsFlow: Flow = _deletedObjectsIdsFlow.asSharedFlow() + override val newObjectsFlow: Flow by lazy { + _newObjectsFlow.asSharedFlow() + } + override val updatedObjectsFlow: Flow by lazy { + _updatedObjectsFlow.asSharedFlow() + } + override val deletedObjectsIdsFlow: Flow by lazy { + _deletedObjectsIdsFlow.asSharedFlow() + } protected abstract fun InsertStatement.asObject(value: InputValueType): ObjectType