mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-03 15:19:44 +00:00
less annotations to god of lessannotations
This commit is contained in:
@@ -5,7 +5,6 @@ import dev.inmo.micro_utils.pagination.PaginationResult
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
interface ReadOneToManyKeyValueRepo<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>
|
||||
@@ -17,7 +16,6 @@ interface ReadOneToManyKeyValueRepo<Key, Value> : Repo {
|
||||
@Deprecated("Renamed", ReplaceWith("ReadOneToManyKeyValueRepo", "dev.inmo.micro_utils.repos.ReadOneToManyKeyValueRepo"))
|
||||
typealias OneToManyReadKeyValueRepo<Key, Value> = ReadOneToManyKeyValueRepo<Key, Value>
|
||||
|
||||
@JsExport
|
||||
interface WriteOneToManyKeyValueRepo<Key, Value> : Repo {
|
||||
val onNewValue: Flow<Pair<Key, Value>>
|
||||
val onValueRemoved: Flow<Pair<Key, Value>>
|
||||
@@ -30,5 +28,4 @@ interface WriteOneToManyKeyValueRepo<Key, Value> : Repo {
|
||||
@Deprecated("Renamed", ReplaceWith("WriteOneToManyKeyValueRepo", "dev.inmo.micro_utils.repos.WriteOneToManyKeyValueRepo"))
|
||||
typealias OneToManyWriteKeyValueRepo<Key, Value> = WriteOneToManyKeyValueRepo<Key, Value>
|
||||
|
||||
@JsExport
|
||||
interface OneToManyKeyValueRepo<Key, Value> : ReadOneToManyKeyValueRepo<Key, Value>, WriteOneToManyKeyValueRepo<Key, Value>
|
@@ -5,7 +5,6 @@ import dev.inmo.micro_utils.pagination.PaginationResult
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
interface ReadStandardCRUDRepo<ObjectType, IdType> : Repo {
|
||||
suspend fun getByPagination(pagination: Pagination): PaginationResult<ObjectType>
|
||||
suspend fun getById(id: IdType): ObjectType?
|
||||
@@ -14,14 +13,11 @@ interface ReadStandardCRUDRepo<ObjectType, IdType> : Repo {
|
||||
}
|
||||
|
||||
typealias UpdatedValuePair<IdType, ValueType> = Pair<IdType, ValueType>
|
||||
@JsExport
|
||||
val <IdType> UpdatedValuePair<IdType, *>.id
|
||||
get() = first
|
||||
@JsExport
|
||||
val <ValueType> UpdatedValuePair<*, ValueType>.value
|
||||
get() = second
|
||||
|
||||
@JsExport
|
||||
interface WriteStandardCRUDRepo<ObjectType, IdType, InputValueType> : Repo {
|
||||
val newObjectsFlow: Flow<ObjectType>
|
||||
val updatedObjectsFlow: Flow<ObjectType>
|
||||
@@ -33,15 +29,12 @@ interface WriteStandardCRUDRepo<ObjectType, IdType, InputValueType> : Repo {
|
||||
suspend fun deleteById(ids: List<IdType>)
|
||||
}
|
||||
|
||||
@JsExport
|
||||
suspend fun <ObjectType, IdType, InputValueType> WriteStandardCRUDRepo<ObjectType, IdType, InputValueType>.create(
|
||||
vararg values: InputValueType
|
||||
): List<ObjectType> = create(values.toList())
|
||||
@JsExport
|
||||
suspend fun <ObjectType, IdType, InputValueType> WriteStandardCRUDRepo<ObjectType, IdType, InputValueType>.update(
|
||||
vararg values: UpdatedValuePair<IdType, InputValueType>
|
||||
): List<ObjectType> = update(values.toList())
|
||||
@JsExport
|
||||
suspend fun <ObjectType, IdType, InputValueType> WriteStandardCRUDRepo<ObjectType, IdType, InputValueType>.deleteById(
|
||||
vararg ids: IdType
|
||||
) = deleteById(ids.toList())
|
||||
|
@@ -5,7 +5,6 @@ import dev.inmo.micro_utils.pagination.PaginationResult
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
interface ReadStandardKeyValueRepo<Key, Value> : Repo {
|
||||
suspend fun get(k: Key): Value?
|
||||
suspend fun values(pagination: Pagination, reversed: Boolean = false): PaginationResult<Value>
|
||||
@@ -14,7 +13,6 @@ interface ReadStandardKeyValueRepo<Key, Value> : Repo {
|
||||
suspend fun count(): Long
|
||||
}
|
||||
|
||||
@JsExport
|
||||
interface WriteStandardKeyValueRepo<Key, Value> : Repo {
|
||||
val onNewValue: Flow<Pair<Key, Value>>
|
||||
val onValueRemoved: Flow<Key>
|
||||
@@ -23,5 +21,4 @@ interface WriteStandardKeyValueRepo<Key, Value> : Repo {
|
||||
suspend fun unset(k: Key)
|
||||
}
|
||||
|
||||
@JsExport
|
||||
interface StandardKeyValueRepo<Key, Value> : ReadStandardKeyValueRepo<Key, Value>, WriteStandardKeyValueRepo<Key, Value>
|
@@ -4,7 +4,6 @@ import dev.inmo.micro_utils.pagination.*
|
||||
import dev.inmo.micro_utils.repos.ReadStandardCRUDRepo
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.doForAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<T>,
|
||||
@@ -17,12 +16,10 @@ suspend inline fun <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.doForAll(
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.doForAll(
|
||||
block: (List<T>) -> Unit
|
||||
) = doForAll({ getByPagination(it) }, block)
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.getAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<T>
|
||||
|
@@ -4,7 +4,6 @@ import dev.inmo.micro_utils.pagination.*
|
||||
import dev.inmo.micro_utils.repos.*
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadStandardKeyValueRepo<Key, Value>> REPO.doForAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<Key>,
|
||||
@@ -17,12 +16,10 @@ suspend inline fun <Key, Value, REPO : ReadStandardKeyValueRepo<Key, Value>> REP
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadStandardKeyValueRepo<Key, Value>> REPO.doForAll(
|
||||
block: (List<Pair<Key, Value>>) -> Unit
|
||||
) = doForAll({ keys(it, false) }, block)
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadStandardKeyValueRepo<Key, Value>> REPO.getAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<Key>
|
||||
|
@@ -4,7 +4,6 @@ import dev.inmo.micro_utils.pagination.*
|
||||
import dev.inmo.micro_utils.repos.*
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadOneToManyKeyValueRepo<Key, Value>> REPO.doForAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<Key>,
|
||||
@@ -27,12 +26,10 @@ suspend inline fun <Key, Value, REPO : ReadOneToManyKeyValueRepo<Key, Value>> RE
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadOneToManyKeyValueRepo<Key, Value>> REPO.doForAll(
|
||||
block: (List<Pair<Key, List<Value>>>) -> Unit
|
||||
) = doForAll({ keys(it, false) }, block)
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadOneToManyKeyValueRepo<Key, Value>> REPO.getAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<Key>
|
||||
|
@@ -4,8 +4,8 @@ import dev.inmo.micro_utils.coroutines.BroadcastFlow
|
||||
import dev.inmo.micro_utils.pagination.*
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlin.js.JsExport
|
||||
import kotlin.js.JsName
|
||||
|
||||
@JsExport
|
||||
class ReadMapCRUDRepo<ObjectType, IdType>(
|
||||
private val map: Map<IdType, ObjectType> = emptyMap()
|
||||
) : ReadStandardCRUDRepo<ObjectType, IdType> {
|
||||
@@ -25,7 +25,6 @@ class ReadMapCRUDRepo<ObjectType, IdType>(
|
||||
override suspend fun count(): Long = map.size.toLong()
|
||||
}
|
||||
|
||||
@JsExport
|
||||
abstract class WriteMapCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||
private val map: MutableMap<IdType, ObjectType> = mutableMapOf()
|
||||
) : WriteStandardCRUDRepo<ObjectType, IdType, InputValueType> {
|
||||
@@ -81,6 +80,7 @@ abstract class MapCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||
WriteMapCRUDRepo<ObjectType, IdType, InputValueType>(map)
|
||||
|
||||
@JsExport
|
||||
@JsName("MapCRUDRepoFactory")
|
||||
fun <ObjectType, IdType, InputValueType> MapCRUDRepo(
|
||||
map: MutableMap<IdType, ObjectType>,
|
||||
updateCallback: suspend (newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType,
|
||||
|
@@ -5,7 +5,6 @@ import dev.inmo.micro_utils.pagination.*
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
class ReadMapKeyValueRepo<Key, Value>(
|
||||
private val map: Map<Key, Value> = emptyMap()
|
||||
) : ReadStandardKeyValueRepo<Key, Value> {
|
||||
@@ -47,7 +46,6 @@ class ReadMapKeyValueRepo<Key, Value>(
|
||||
override suspend fun count(): Long = map.size.toLong()
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class WriteMapKeyValueRepo<Key, Value>(
|
||||
private val map: MutableMap<Key, Value> = mutableMapOf()
|
||||
) : WriteStandardKeyValueRepo<Key, Value> {
|
||||
|
@@ -6,7 +6,6 @@ import dev.inmo.micro_utils.pagination.utils.paginate
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
class MapReadOneToManyKeyValueRepo<Key, Value>(
|
||||
private val map: Map<Key, List<Value>> = emptyMap()
|
||||
) : ReadOneToManyKeyValueRepo<Key, Value> {
|
||||
@@ -46,7 +45,6 @@ class MapReadOneToManyKeyValueRepo<Key, Value>(
|
||||
override suspend fun count(): Long = map.size.toLong()
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class MapWriteOneToManyKeyValueRepo<Key, Value>(
|
||||
private val map: MutableMap<Key, MutableList<Value>> = mutableMapOf()
|
||||
) : WriteOneToManyKeyValueRepo<Key, Value> {
|
||||
|
@@ -13,7 +13,6 @@ import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
class KtorReadStandardCrudRepo<ObjectType, IdType> (
|
||||
private val baseUrl: String,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
|
@@ -13,7 +13,6 @@ import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.builtins.*
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
class KtorWriteStandardCrudRepo<ObjectType, IdType, InputValue> (
|
||||
private val baseUrl: String,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
|
@@ -13,7 +13,6 @@ import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
class KtorReadStandardKeyValueRepo<Key, Value> (
|
||||
private var baseUrl: String,
|
||||
private var client: HttpClient = HttpClient(),
|
||||
|
@@ -13,7 +13,6 @@ import kotlinx.serialization.builtins.PairSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
class KtorWriteStandardKeyValueRepo<K, V> (
|
||||
private var baseUrl: String,
|
||||
private var client: HttpClient = HttpClient(),
|
||||
|
@@ -13,7 +13,6 @@ import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
class KtorReadOneToManyKeyValueRepo<Key, Value> (
|
||||
private val baseUrl: String,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
|
@@ -13,7 +13,6 @@ import kotlinx.serialization.builtins.PairSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
||||
private val baseUrl: String,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
|
Reference in New Issue
Block a user