From 6f73b6683e5fcf36e768288d590b587a4a768bbd Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Tue, 30 Jul 2019 23:10:09 +0200 Subject: [PATCH] feature: add vararg of Pair for function --- .../fr/postgresjson/connexion/Function.kt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/kotlin/fr/postgresjson/connexion/Function.kt b/src/main/kotlin/fr/postgresjson/connexion/Function.kt index 69877e9..e7c17f1 100644 --- a/src/main/kotlin/fr/postgresjson/connexion/Function.kt +++ b/src/main/kotlin/fr/postgresjson/connexion/Function.kt @@ -52,6 +52,12 @@ class Function(val definition: Function, override val connection: Connection): E ): R? = select(object: TypeReference() {}, values, block) + inline fun > selectOne( + vararg values: Pair, + noinline block: SelectOneCallback = {} + ): R? = + selectOne(values.toMap(), block) + /* Select Multiples */ /** @@ -94,6 +100,12 @@ class Function(val definition: Function, override val connection: Connection): E ): List = select(object: TypeReference>() {}, values, block) + inline fun > select( + vararg values: Pair, + noinline block: SelectCallback = {} + ): List = + select(values.toMap(), block) + /* Select Paginated */ /** @@ -125,6 +137,14 @@ class Function(val definition: Function, override val connection: Connection): E ): Paginated = select(page, limit, object: TypeReference>() {}, values, block) + inline fun > select( + page: Int, + limit: Int, + vararg values: Pair, + noinline block: SelectPaginatedCallback = {} + ): Paginated = + select(page, limit, object: TypeReference>() {}, values.toMap(), block) + /* Execute function without traitements */ override fun exec(values: List): QueryResult {