All Downloads are FREE. Search and download functionalities are using the official Maven repository.

run.smt.ktest.db.query.procedure-queries.kt Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package run.smt.ktest.db.query

import run.smt.ktest.db.query.impl.ProcedureBuilderImpl
import org.springframework.jdbc.core.JdbcTemplate
import javax.sql.DataSource
import java.sql.Date as SqlDate

/**
 * Callable query
 */
inline fun  DataSource.call(query: String? = null, build: ProcedureBuilder.() -> Unit): Response {
    val builder = ProcedureBuilderImpl(query)
    builder.mapTo = T::class
    builder.build()
    return builder.execute(JdbcTemplate(this))
}

inline fun  DataSource.call(query: String): Response = call(query) {}

fun DataSource.execute(procedure: String?, build: PlainProcedureBuilder.() -> Unit) {
    call(procedure, build).single()
}

fun DataSource.execute(procedure: String) = execute(procedure) {}

private class NoArg




© 2015 - 2024 Weber Informatics LLC | Privacy Policy