protecteds in map repos instead of privates

This commit is contained in:
InsanusMokrassar 2021-09-09 12:16:12 +06:00
parent 55ffd4b46f
commit bdcc179b7b
3 changed files with 9 additions and 5 deletions

View File

@ -2,6 +2,10 @@
## 0.5.26
* `Repos`:
* `InMemory`:
* `MapCRUDRepo`s and `MapKeyValueRepo`s got `protected` methods and properties instead of private
## 0.5.25
* `Versions`:

View File

@ -23,13 +23,13 @@ class ReadMapCRUDRepo<ObjectType, IdType>(
}
abstract class WriteMapCRUDRepo<ObjectType, IdType, InputValueType>(
private val map: MutableMap<IdType, ObjectType> = mutableMapOf()
protected val map: MutableMap<IdType, ObjectType> = mutableMapOf()
) : WriteStandardCRUDRepo<ObjectType, IdType, InputValueType> {
private val _newObjectsFlow: MutableSharedFlow<ObjectType> = MutableSharedFlow()
protected val _newObjectsFlow: MutableSharedFlow<ObjectType> = MutableSharedFlow()
override val newObjectsFlow: Flow<ObjectType> = _newObjectsFlow.asSharedFlow()
private val _updatedObjectsFlow: MutableSharedFlow<ObjectType> = MutableSharedFlow()
protected val _updatedObjectsFlow: MutableSharedFlow<ObjectType> = MutableSharedFlow()
override val updatedObjectsFlow: Flow<ObjectType> = _updatedObjectsFlow.asSharedFlow()
private val _deletedObjectsIdsFlow: MutableSharedFlow<IdType> = MutableSharedFlow()
protected val _deletedObjectsIdsFlow: MutableSharedFlow<IdType> = MutableSharedFlow()
override val deletedObjectsIdsFlow: Flow<IdType> = _deletedObjectsIdsFlow.asSharedFlow()
protected abstract suspend fun updateObject(newValue: InputValueType, id: IdType, old: ObjectType): ObjectType

View File

@ -8,7 +8,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
class ReadMapKeyValueRepo<Key, Value>(
private val map: Map<Key, Value> = emptyMap()
protected val map: Map<Key, Value> = emptyMap()
) : ReadStandardKeyValueRepo<Key, Value> {
override suspend fun get(k: Key): Value? = map[k]