package fr.postgresjson.connexion import com.fasterxml.jackson.core.type.TypeReference import fr.postgresjson.entity.EntityI /* Update */ /** * Update [EntityI] with one entity as argument */ inline fun Executable.update( sql: String, value: R, noinline block: SelectOneCallback = {} ): R? = update(sql, object : TypeReference() {}, value, block) /* Select One */ /** * Select One [EntityI] with [List] of parameters */ inline fun Executable.selectOne( sql: String, values: List = emptyList(), noinline block: SelectOneCallback = {} ): R? = selectOne(sql, object : TypeReference() {}, values, block) /** * Select One [EntityI] with [Map] of parameters */ inline fun Executable.selectOne( sql: String, values: Map, noinline block: SelectOneCallback = {} ): R? = selectOne(sql, object : TypeReference() {}, values, block) /** * Select One [EntityI] with multiple [Pair] of parameters */ inline fun Executable.selectOne( sql: String, vararg values: Pair, noinline block: SelectOneCallback = {} ): R? = selectOne(sql, object : TypeReference() {}, values = values, block) /* Select Multiples */ /** * Select Multiple [EntityI] with [List] of parameters */ inline fun Executable.select( sql: String, values: List = emptyList(), noinline block: SelectCallback = {} ): List = select(sql, object : TypeReference>() {}, values, block) /** * Select Multiple [EntityI] with [Map] of parameters */ inline fun Executable.select( sql: String, values: Map, noinline block: SelectCallback = {} ): List = select(sql, object : TypeReference>() {}, values, block) /** * Select Multiple [EntityI] with multiple [Pair] of parameters */ inline fun Executable.select( sql: String, vararg values: Pair, noinline block: SelectCallback = {} ): List = select(sql, object : TypeReference>() {}, values = values, block) /* Select Paginated */ /** * Select Paginated [EntityI] with [Map] of parameters */ inline fun Executable.select( sql: String, page: Int, limit: Int, values: Map = emptyMap(), noinline block: SelectPaginatedCallback = {} ): Paginated = select(sql, page, limit, object : TypeReference>() {}, values, block) /** * Select Paginated [EntityI] with multiple [Pair] of parameters */ inline fun Executable.select( sql: String, page: Int, limit: Int, vararg values: Pair, noinline block: SelectPaginatedCallback = {} ): Paginated = select(sql, page, limit, object : TypeReference>() {}, values = values, block)