Clean the request process
Remove paginated Remove Entity classes Add Annotation for serialize object rename selectOne/selectMultiple to execute
This commit is contained in:
@@ -1,68 +1,25 @@
|
||||
package fr.postgresjson.connexion
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference
|
||||
import fr.postgresjson.entity.EntityI
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
/* Select One */
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.update(
|
||||
value: R,
|
||||
noinline block: SelectOneCallback<R> = {}
|
||||
): R? =
|
||||
update(object : TypeReference<R>() {}, value, block)
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.selectOne(
|
||||
values: List<Any?>,
|
||||
noinline block: SelectOneCallback<R> = {}
|
||||
): R? =
|
||||
selectOne(object : TypeReference<R>() {}, values, block)
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.selectOne(
|
||||
values: Map<String, Any?>,
|
||||
noinline block: SelectOneCallback<R> = {}
|
||||
): R? =
|
||||
selectOne(object : TypeReference<R>() {}, values, block)
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.selectOne(
|
||||
vararg values: Pair<String, Any?>,
|
||||
noinline block: SelectOneCallback<R> = {}
|
||||
): R? =
|
||||
selectOne(object : TypeReference<R>() {}, values = values, block)
|
||||
|
||||
/* Select Multiples */
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.select(
|
||||
@Throws(DataNotFoundException::class)
|
||||
inline fun <reified R : Any> EmbedExecutable.execute(
|
||||
values: List<Any?>,
|
||||
noinline block: SelectCallback<R> = {}
|
||||
): List<R> =
|
||||
select(object : TypeReference<List<R>>() {}, values, block)
|
||||
): R? =
|
||||
execute(object : TypeReference<R>() {}, values, block)
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.select(
|
||||
@Throws(DataNotFoundException::class)
|
||||
inline fun <reified R : Any> EmbedExecutable.execute(
|
||||
values: Map<String, Any?>,
|
||||
noinline block: SelectCallback<R> = {}
|
||||
): List<R> =
|
||||
select(object : TypeReference<List<R>>() {}, values, block)
|
||||
): R? =
|
||||
execute(object : TypeReference<R>() {}, values, block)
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.select(
|
||||
@Throws(DataNotFoundException::class)
|
||||
inline fun <reified R : Any> EmbedExecutable.execute(
|
||||
vararg values: Pair<String, Any?>,
|
||||
noinline block: SelectCallback<R> = {}
|
||||
): List<R> =
|
||||
select(object : TypeReference<List<R>>() {}, values = values, block)
|
||||
|
||||
/* Select Paginated */
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.select(
|
||||
page: Int,
|
||||
limit: Int,
|
||||
values: Map<String, Any?> = emptyMap(),
|
||||
noinline block: SelectPaginatedCallback<R> = {}
|
||||
): Paginated<R> =
|
||||
select(page, limit, object : TypeReference<List<R>>() {}, values, block)
|
||||
|
||||
inline fun <reified R : EntityI> EmbedExecutable.select(
|
||||
page: Int,
|
||||
limit: Int,
|
||||
vararg values: Pair<String, Any?>,
|
||||
noinline block: SelectPaginatedCallback<R> = {}
|
||||
): Paginated<R> =
|
||||
select(page, limit, object : TypeReference<List<R>>() {}, values = values, block)
|
||||
): R? =
|
||||
execute(object : TypeReference<R>() {}, values = values, block)
|
||||
|
||||
Reference in New Issue
Block a user