Alexander Ioffe
04/14/2024, 6:11 PM"with $dollar $sign $variables"
capturing the variables before they are spliced into the surrounding string.
This allows for third party Kotlin libraries to create functionality like sql-prefixed strings e.g:
val ps: PreparedStatement = sql("SELECT * FROM person WHERE name = $joe")
...and they'll get captured into an array BEFORE being spliced. So you can then put them into a PreparedStatement correctly without worrying about SQL-injection attacks!
Using this kind of functionality Scala libraries like Doobie and Quill allow a set of rich SQL operations. Hopefully now Kotlin libraries will be able to create similar things.
(P.S. Currently the library is JVM-only, if there's an ask for KMP I'll look into it)
(UPDATE I am currently waiting for approval from plugins.gradle.org to be able to publish the plugin)
https://github.com/deusaquilus/TerpalMohammad Zaki
04/15/2024, 5:27 PMAlexander Ioffe
04/15/2024, 5:58 PMAlexander Ioffe
04/28/2024, 4:53 PMMohammad Zaki
05/02/2024, 1:19 PM