A Kotlin/JVM database client for those who want to write SQL
https://kuery-client.hsbrysk.dev/ ↗// readme
Write SQL as it is.
A Kotlin SQL client built on Spring Data — interpolated runtime values become bind parameters via a compiler plugin.
It looks like plain string interpolation…
val user: User? = kueryClient
.sql { +"SELECT * FROM users WHERE user_id = $userId" }
.singleOrNull()
…but it executes as a parameterized query. A Kotlin compiler plugin rewrites the interpolated runtime value into named parameter binding at compile time — so you get the readability of raw SQL without the risk of SQL injection:
SELECT * FROM users WHERE user_id = :p0 -- :p0 = userId, bound as a named parameter
Why Kuery Client?
- ♥️ Love SQL
- ORM libraries are convenient, but they each require learning their own DSL, which we believe is a steep cost. Kuery Client emphasizes writing SQL as it is.
- 🛡️ Safe by design
- Interpolated runtime values are converted into bind parameters by the compiler plugin, so the normal SQL-building path never concatenates them into the SQL text.
- ✅ Compile-time checks
- The compiler plugin [warns when a SQL string cannot be converted…