MicroUtils/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/OneToManyKeyValueRepo.kt
2020-09-20 12:17:11 +10:00

23 lines
863 B
Kotlin

package dev.inmo.micro_utils.repos
import dev.inmo.micro_utils.pagination.Pagination
import dev.inmo.micro_utils.pagination.PaginationResult
interface OneToManyReadKeyValueRepo<Key, Value> : Repo {
suspend fun get(k: Key, pagination: Pagination, reversed: Boolean = false): PaginationResult<Value>
suspend fun keys(pagination: Pagination, reversed: Boolean = false): PaginationResult<Key>
suspend fun contains(k: Key): Boolean
suspend fun contains(k: Key, v: Value): Boolean
suspend fun count(k: Key): Long
suspend fun count(): Long
}
interface OneToManyWriteKeyValueRepo<Key, Value> :
Repo {
suspend fun add(k: Key, v: Value)
suspend fun remove(k: Key, v: Value)
suspend fun clear(k: Key)
}
interface OneToManyKeyValueRepo<Key, Value> : OneToManyReadKeyValueRepo<Key, Value>,
OneToManyWriteKeyValueRepo<Key, Value>