run.smt.ktest.db.query.select-queries.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ktest-db Show documentation
Show all versions of ktest-db Show documentation
Database intergration for kTest
package run.smt.ktest.db.query
import run.smt.ktest.db.query.impl.SelectBuilder
import org.springframework.jdbc.core.JdbcTemplate
import javax.sql.DataSource
inline fun DataSource.select(query: String): Response {
return select(query) {}
}
inline fun DataSource.select(query: String? = null, build: SelectBuilder.() -> Unit): Response {
val builder = SelectBuilder(query)
builder.mapTo(T::class)
builder.build()
return builder.execute(JdbcTemplate(this))
}