Improve gradle tasks
This commit is contained in:
@@ -12,7 +12,7 @@ import fr.postgresjson.entity.Serializable
|
||||
import fr.postgresjson.serializer.Serializer
|
||||
import fr.postgresjson.utils.LoggerDelegate
|
||||
import org.slf4j.Logger
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
typealias SelectOneCallback<T> = QueryResult.(T?) -> Unit
|
||||
typealias SelectCallback<T> = QueryResult.(List<T>) -> Unit
|
||||
@@ -280,11 +280,14 @@ class Connection(
|
||||
logger?.debug("Query executed in $duration ms \n{}", args)
|
||||
return result
|
||||
} catch (e: Throwable) {
|
||||
logger?.info("""
|
||||
logger?.info(
|
||||
"""
|
||||
Query Error:
|
||||
${sql.prependIndent()},
|
||||
${values.joinToString(", ").prependIndent()}
|
||||
""".trimIndent(), e)
|
||||
""".trimIndent(),
|
||||
e
|
||||
)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,4 +59,4 @@ interface EmbedExecutable {
|
||||
fun sendQuery(values: Map<String, Any?>): Int
|
||||
fun sendQuery(vararg values: Pair<String, Any?>): Int =
|
||||
sendQuery(values.toMap())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,4 +52,4 @@ interface Executable {
|
||||
fun exec(sql: String, values: Map<String, Any?>): QueryResult
|
||||
fun sendQuery(sql: String, values: List<Any?> = emptyList()): Int
|
||||
fun sendQuery(sql: String, values: Map<String, Any?>): Int
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,4 +205,4 @@ class Function(val definition: Function, override val connection: Connection) :
|
||||
|
||||
return placeholders.joinToString(separator = ", ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +22,4 @@ data class Paginated<T : EntityI>(
|
||||
fun isLastPage(): Boolean = currentPage >= totalPages
|
||||
|
||||
private fun Double.ceil(): Int = ceil(this).toInt()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,4 +106,4 @@ class Query(override val name: String, private val sql: String, override val con
|
||||
override fun sendQuery(values: Map<String, Any?>): Int {
|
||||
return connection.sendQuery(sql, values)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package fr.postgresjson.connexion
|
||||
import fr.postgresjson.utils.searchSqlFiles
|
||||
import java.net.URI
|
||||
import fr.postgresjson.definition.Function as DefinitionFunction
|
||||
import fr.postgresjson.definition.Function as FunctionDefinition
|
||||
import fr.postgresjson.definition.Query as QueryDefinition
|
||||
|
||||
class Requester(
|
||||
@@ -52,7 +51,7 @@ class Requester(
|
||||
fun addFunction(functionsDirectory: URI): Requester {
|
||||
functionsDirectory.searchSqlFiles()
|
||||
.forEach {
|
||||
if (it is FunctionDefinition) {
|
||||
if (it is DefinitionFunction) {
|
||||
addFunction(it)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user