mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-04 23:59:29 +00:00
repos update
This commit is contained in:
@@ -43,21 +43,13 @@ interface WriteOneToManyKeyValueRepo<Key, Value> : Repo {
|
||||
val onValueRemoved: Flow<Pair<Key, Value>>
|
||||
val onDataCleared: Flow<Key>
|
||||
|
||||
suspend fun add(toAdd: Map<Key, List<Value>>) = toAdd.forEach { (k, values) ->
|
||||
values.forEach { v ->
|
||||
add(k, v)
|
||||
}
|
||||
}
|
||||
suspend fun add(toAdd: Map<Key, List<Value>>)
|
||||
@Deprecated("Will be extracted as extension for other add method")
|
||||
suspend fun add(k: Key, v: Value)
|
||||
suspend fun add(k: Key, v: Value) = add(mapOf(k to listOf(v)))
|
||||
|
||||
suspend fun remove(toRemove: Map<Key, List<Value>>) = toRemove.forEach { (k, values) ->
|
||||
values.forEach { v ->
|
||||
remove(k, v)
|
||||
}
|
||||
}
|
||||
suspend fun remove(toRemove: Map<Key, List<Value>>)
|
||||
@Deprecated("Will be extracted as extension for other remove method")
|
||||
suspend fun remove(k: Key, v: Value)
|
||||
suspend fun remove(k: Key, v: Value) = remove(mapOf(k to listOf(v)))
|
||||
|
||||
suspend fun clear(k: Key)
|
||||
}
|
||||
|
@@ -16,8 +16,16 @@ interface WriteStandardKeyValueRepo<Key, Value> : Repo {
|
||||
val onNewValue: Flow<Pair<Key, Value>>
|
||||
val onValueRemoved: Flow<Key>
|
||||
|
||||
@Deprecated("Realize set with map instead")
|
||||
suspend fun set(k: Key, v: Value)
|
||||
suspend fun set(toSet: Map<Key, Value>) = toSet.forEach { (k, v) ->
|
||||
set(k, v)
|
||||
}
|
||||
@Deprecated("Realize unset with list instead")
|
||||
suspend fun unset(k: Key)
|
||||
suspend fun unset(toUnset: List<Key>) = toUnset.forEach {
|
||||
unset(it)
|
||||
}
|
||||
}
|
||||
|
||||
interface StandardKeyValueRepo<Key, Value> : ReadStandardKeyValueRepo<Key, Value>, WriteStandardKeyValueRepo<Key, Value>
|
Reference in New Issue
Block a user