mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-01 22:40:09 +00:00
commit
6c12001080
@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.20.20
|
||||||
|
|
||||||
|
* `Repos`:
|
||||||
|
* `Exposed`:
|
||||||
|
* Add opportunity for setup flows in `AbstractExposedCRUDRepo`
|
||||||
|
|
||||||
## 0.20.19
|
## 0.20.19
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@ -15,5 +15,5 @@ crypto_js_version=4.1.1
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.20.19
|
version=0.20.20
|
||||||
android_code_version=225
|
android_code_version=226
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
package dev.inmo.micro_utils.repos.exposed
|
package dev.inmo.micro_utils.repos.exposed
|
||||||
|
|
||||||
import dev.inmo.micro_utils.repos.CRUDRepo
|
import dev.inmo.micro_utils.repos.CRUDRepo
|
||||||
|
import kotlinx.coroutines.channels.BufferOverflow
|
||||||
|
|
||||||
abstract class AbstractExposedCRUDRepo<ObjectType, IdType, InputValueType>(
|
abstract class AbstractExposedCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||||
flowsChannelsSize: Int = 0,
|
flowsChannelsSize: Int = 0,
|
||||||
tableName: String = ""
|
tableName: String = "",
|
||||||
|
replyCacheInFlows: Int = 0,
|
||||||
|
onBufferOverflowBehaviour: BufferOverflow = BufferOverflow.SUSPEND
|
||||||
) :
|
) :
|
||||||
AbstractExposedWriteCRUDRepo<ObjectType, IdType, InputValueType>(
|
AbstractExposedWriteCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||||
flowsChannelsSize,
|
flowsChannelsSize,
|
||||||
tableName
|
tableName,
|
||||||
|
replyCacheInFlows,
|
||||||
|
onBufferOverflowBehaviour
|
||||||
),
|
),
|
||||||
ExposedCRUDRepo<ObjectType, IdType>,
|
ExposedCRUDRepo<ObjectType, IdType>,
|
||||||
CRUDRepo<ObjectType, IdType, InputValueType>
|
CRUDRepo<ObjectType, IdType, InputValueType>
|
||||||
|
@ -2,6 +2,7 @@ package dev.inmo.micro_utils.repos.exposed
|
|||||||
|
|
||||||
import dev.inmo.micro_utils.repos.UpdatedValuePair
|
import dev.inmo.micro_utils.repos.UpdatedValuePair
|
||||||
import dev.inmo.micro_utils.repos.WriteCRUDRepo
|
import dev.inmo.micro_utils.repos.WriteCRUDRepo
|
||||||
|
import kotlinx.coroutines.channels.BufferOverflow
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.statements.*
|
import org.jetbrains.exposed.sql.statements.*
|
||||||
@ -11,19 +12,26 @@ import java.util.Objects
|
|||||||
abstract class AbstractExposedWriteCRUDRepo<ObjectType, IdType, InputValueType>(
|
abstract class AbstractExposedWriteCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||||
flowsChannelsSize: Int = 0,
|
flowsChannelsSize: Int = 0,
|
||||||
tableName: String = "",
|
tableName: String = "",
|
||||||
replyCacheInFlows: Int = 0
|
replyCacheInFlows: Int = 0,
|
||||||
|
onBufferOverflowBehaviour: BufferOverflow = BufferOverflow.SUSPEND
|
||||||
) :
|
) :
|
||||||
AbstractExposedReadCRUDRepo<ObjectType, IdType>(tableName),
|
AbstractExposedReadCRUDRepo<ObjectType, IdType>(tableName),
|
||||||
ExposedCRUDRepo<ObjectType, IdType>,
|
ExposedCRUDRepo<ObjectType, IdType>,
|
||||||
WriteCRUDRepo<ObjectType, IdType, InputValueType>
|
WriteCRUDRepo<ObjectType, IdType, InputValueType>
|
||||||
{
|
{
|
||||||
protected val _newObjectsFlow = MutableSharedFlow<ObjectType>(replyCacheInFlows, flowsChannelsSize)
|
protected open val _newObjectsFlow = MutableSharedFlow<ObjectType>(replyCacheInFlows, flowsChannelsSize, onBufferOverflowBehaviour)
|
||||||
protected val _updatedObjectsFlow = MutableSharedFlow<ObjectType>(replyCacheInFlows, flowsChannelsSize)
|
protected open val _updatedObjectsFlow = MutableSharedFlow<ObjectType>(replyCacheInFlows, flowsChannelsSize, onBufferOverflowBehaviour)
|
||||||
protected val _deletedObjectsIdsFlow = MutableSharedFlow<IdType>(replyCacheInFlows, flowsChannelsSize)
|
protected open val _deletedObjectsIdsFlow = MutableSharedFlow<IdType>(replyCacheInFlows, flowsChannelsSize, onBufferOverflowBehaviour)
|
||||||
|
|
||||||
override val newObjectsFlow: Flow<ObjectType> = _newObjectsFlow.asSharedFlow()
|
override val newObjectsFlow: Flow<ObjectType> by lazy {
|
||||||
override val updatedObjectsFlow: Flow<ObjectType> = _updatedObjectsFlow.asSharedFlow()
|
_newObjectsFlow.asSharedFlow()
|
||||||
override val deletedObjectsIdsFlow: Flow<IdType> = _deletedObjectsIdsFlow.asSharedFlow()
|
}
|
||||||
|
override val updatedObjectsFlow: Flow<ObjectType> by lazy {
|
||||||
|
_updatedObjectsFlow.asSharedFlow()
|
||||||
|
}
|
||||||
|
override val deletedObjectsIdsFlow: Flow<IdType> by lazy {
|
||||||
|
_deletedObjectsIdsFlow.asSharedFlow()
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract fun InsertStatement<Number>.asObject(value: InputValueType): ObjectType
|
protected abstract fun InsertStatement<Number>.asObject(value: InputValueType): ObjectType
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user