mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-07 17:19:32 +00:00
add map type info in ktor read kv and crud repos
This commit is contained in:
@@ -44,6 +44,7 @@ class KtorCRUDRepoClient<ObjectType, IdType, InputValue> (
|
|||||||
typeInfo<PaginationResult<ObjectType>>(),
|
typeInfo<PaginationResult<ObjectType>>(),
|
||||||
typeInfo<PaginationResult<IdType>>(),
|
typeInfo<PaginationResult<IdType>>(),
|
||||||
contentType,
|
contentType,
|
||||||
|
typeInfo<Map<IdType, ObjectType>>(),
|
||||||
idSerializer
|
idSerializer
|
||||||
),
|
),
|
||||||
KtorWriteCrudRepoClient<ObjectType, IdType, InputValue>(
|
KtorWriteCrudRepoClient<ObjectType, IdType, InputValue>(
|
||||||
|
@@ -22,6 +22,7 @@ class KtorReadCRUDRepoClient<ObjectType, IdType> (
|
|||||||
private val paginationObjectType: TypeInfo,
|
private val paginationObjectType: TypeInfo,
|
||||||
private val paginationIdType: TypeInfo,
|
private val paginationIdType: TypeInfo,
|
||||||
private val contentType: ContentType,
|
private val contentType: ContentType,
|
||||||
|
private val mapTypeInfo: TypeInfo,
|
||||||
private val idSerializer: suspend (IdType) -> String
|
private val idSerializer: suspend (IdType) -> String
|
||||||
) : ReadCRUDRepo<ObjectType, IdType> {
|
) : ReadCRUDRepo<ObjectType, IdType> {
|
||||||
override suspend fun getByPagination(pagination: Pagination): PaginationResult<ObjectType> = httpClient.get(
|
override suspend fun getByPagination(pagination: Pagination): PaginationResult<ObjectType> = httpClient.get(
|
||||||
@@ -66,7 +67,7 @@ class KtorReadCRUDRepoClient<ObjectType, IdType> (
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
contentType(contentType)
|
contentType(contentType)
|
||||||
}.body()
|
}.body(mapTypeInfo)
|
||||||
|
|
||||||
override suspend fun count(): Long = httpClient.get(
|
override suspend fun count(): Long = httpClient.get(
|
||||||
buildStandardUrl(
|
buildStandardUrl(
|
||||||
@@ -90,6 +91,7 @@ inline fun <reified ObjectType, IdType> KtorReadCRUDRepoClient(
|
|||||||
typeInfo<PaginationResult<ObjectType>>(),
|
typeInfo<PaginationResult<ObjectType>>(),
|
||||||
typeInfo<PaginationResult<IdType>>(),
|
typeInfo<PaginationResult<IdType>>(),
|
||||||
contentType,
|
contentType,
|
||||||
|
typeInfo<Map<IdType, ObjectType>>(),
|
||||||
idSerializer
|
idSerializer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ class KtorReadKeyValueRepoClient<Key, Value>(
|
|||||||
private val objectType: TypeInfo,
|
private val objectType: TypeInfo,
|
||||||
private val paginationResultObjectsTypeInfo: TypeInfo,
|
private val paginationResultObjectsTypeInfo: TypeInfo,
|
||||||
private val paginationResultIdsTypeInfo: TypeInfo,
|
private val paginationResultIdsTypeInfo: TypeInfo,
|
||||||
|
private val mapKeyValueTypeInfo: TypeInfo,
|
||||||
private val idSerializer: suspend (Key) -> String,
|
private val idSerializer: suspend (Key) -> String,
|
||||||
private val valueSerializer: suspend (Value) -> String
|
private val valueSerializer: suspend (Value) -> String
|
||||||
) : ReadKeyValueRepo<Key, Value> {
|
) : ReadKeyValueRepo<Key, Value> {
|
||||||
@@ -55,7 +56,7 @@ class KtorReadKeyValueRepoClient<Key, Value>(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
contentType(contentType)
|
contentType(contentType)
|
||||||
}.body()
|
}.body(mapKeyValueTypeInfo)
|
||||||
|
|
||||||
override suspend fun values(
|
override suspend fun values(
|
||||||
pagination: Pagination,
|
pagination: Pagination,
|
||||||
@@ -112,6 +113,7 @@ inline fun <reified Key, reified Value> KtorReadKeyValueRepoClient(
|
|||||||
typeInfo<Value>(),
|
typeInfo<Value>(),
|
||||||
typeInfo<PaginationResult<Value>>(),
|
typeInfo<PaginationResult<Value>>(),
|
||||||
typeInfo<PaginationResult<Key>>(),
|
typeInfo<PaginationResult<Key>>(),
|
||||||
|
typeInfo<Map<Key, Value>>(),
|
||||||
idSerializer,
|
idSerializer,
|
||||||
valueSerializer
|
valueSerializer
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user