KueryBlockingClient

A blocking SQL client.

SQL is written with plain Kotlin string interpolation inside the sql block; the Kuery Client compiler plugin rewrites interpolated runtime values into named bind parameters, so they are never concatenated into the SQL text. Compile-time String and Char constants are expanded into the SQL text instead.

val user: User = client.sql { +"SELECT * FROM users WHERE user_id = $userId" }.single()

Implementations are expected to be thread-safe; a single instance can be shared across the whole application.

For a coroutine-based (R2DBC) counterpart, see KueryClient.

Types

Link copied to clipboard
interface FetchSpec

Specifies how to execute the built SQL and retrieve the results.

Functions

Link copied to clipboard
abstract fun sql(block: SqlBuilder.() -> Unit): KueryBlockingClient.FetchSpec
abstract fun sql(sqlId: String, block: SqlBuilder.() -> Unit): KueryBlockingClient.FetchSpec

Builds SQL using the received SqlBuilder block and returns a FetchSpec to obtain the execution results.