https://kotlinlang.org logo
Join Slack
Powered by
# terpal
  • a

    Alexander Ioffe

    09/20/2024, 12:41 AM
    Hum, actually I'm not sure it will work with context functions that I see you're using. I need to check if that's possible. If it's not I could probably fix that.
    i
    c
    • 3
    • 14
  • a

    Alexander Ioffe

    09/27/2024, 1:31 AM
    My present dilemma:
    👉 1
    laugh cry face palm 1
  • l

    Lt. Templeton Peck

    10/01/2024, 11:59 AM
    Updating to
    Copy code
    terpal = "2.0.0-0.3.1"
    terpal-plugin = "2.0.20-1.0.0.PL"
    Has broken my build as it can no longer import
    io.exoquery.sql.jdbc.Sql
    I can see there are changes to use
    io.exoquery.sql.Sql
    instead but that isn't available from
    terpal-sql-core
    for
    2.0.0-0.3.1
  • a

    Alexander Ioffe

    10/02/2024, 4:04 PM
    @Lt. Templeton Peck Don't update to the latest version of Terpal yet. I have yet to publish the terpal-sql version for terpal 2.0.20-1.0.0.PL.
    👍 1
  • a

    Alexander Ioffe

    10/02/2024, 4:06 PM
    The way it's going to be is: • KotlinVersion-TerpalVersion.PL (i.e. PL stands for Plugin) • TerpalVersion.PL-TerpalSqlVersion • So for the terpal-plugin 2.0.0-1.2.3.PL you'll use 1.2.3.PL-4.5.6 terpal-sql
  • a

    Alexander Ioffe

    10/02/2024, 4:07 PM
    I'm doing this so that I can move terpal-sql versions independently of the plugin (which needs a new version for every kotlin version).
  • a

    Alexander Ioffe

    10/02/2024, 4:07 PM
    I haven't published a terpal-sql version for terpal 1.0.0.PL yet.
  • a

    Alexander Ioffe

    10/02/2024, 4:13 PM
    Hopefully this coming weekend I'm going to publish Terpal-SQL 1.0.0.PL-1.0.0. In this release
    io.exoquery.sql.jdbc.Sql
    will be deprecated and I'll have a proper
    ReplaceWith(io.exoquery.sql.Sql)
    .
    🙌 1
  • a

    Alexander Ioffe

    10/02/2024, 4:27 PM
    (Also it will support KMP Android, IOs, OSX, Linux and Windows targets.)
    🔥 1
  • a

    Alexander Ioffe

    10/07/2024, 12:43 PM
    Update: Terpal KMP (1.0.0.PL-1.0.0) is done and tested on Android. I haven’t been able to test on IOS yet (if anyone wants to try it please let me know and I’ll do an RC release). I’ll try to test it out on IOS sometime this week.
  • a

    Alexander Ioffe

    10/15/2024, 12:47 PM
    Terpal-SQL for Kotlin Multiplatform is out: https://kotlinlang.slack.com/archives/C0BJ0GTE2/p1728996274425839
  • a

    Alexander Ioffe

    10/16/2024, 5:16 AM
    Also, the terpal-sql microsite is up: https://terpal.io/
    🎉 3
  • p

    phldavies

    11/21/2024, 7:14 PM
    @Alexander Ioffe Any chance the next release can be forward of the previous releases. Dependabot keeps wanting to "update" io.exoquery:terpal-sql-jdbc from 1.0.0.PL-1.1.0 to 2.0.0-0.3.1
    ➕ 1
  • a

    Alexander Ioffe

    11/21/2024, 11:38 PM
    Yeah, lots of maven-based systems have the same logic. Next PL version I publish will be 2.0.0
    ❤️ 1
  • l

    Lt. Templeton Peck

    11/27/2024, 3:02 PM
    @Alexander Ioffe any chance you can bump the Gradle terpal-plugin to Kotlin 2.1.0 which got released today?
    a
    • 2
    • 3
  • a

    Arjan van Wieringen

    12/08/2024, 3:54 PM
    Am I correct that
    Copy code
    Sql(""" .... multiline string ... """)
    Is not supported?
    a
    • 2
    • 2
  • p

    phldavies

    01/22/2025, 10:36 PM
    Is it possible to use a reified type in a
    wrap
    method? I'd like to implement a json interpolator that implicitly uses
    Json.encodeToJsonElement()
    when handling any parameter that isn't a json primitive. I can work around it by doing
    """{"field": ${json.encodeToJsonElement(myVal)}}"""
    but would ideally use
    """{"field": $myVal}"""
    (obviously using a helper can at least make this something like
    """{"field": ${json(myVal)}}"""
    at least helps here) I've tried
    inline fun <reified T> JsonInterpolator.wrap(value: T): JsonElement = Json.encodeToString(value)
    but it doesn't like the type parameter and I'm guessing it won't properly inline the call either.
  • a

    Alexander Ioffe

    01/26/2025, 2:55 PM
    That should work, this is a bug.
  • a

    Alexander Ioffe

    01/26/2025, 2:56 PM
    I’ll work on fixing it. The problem is that the typing of the
    wrap
    function doesn’t reason about types vs classes well enough, I’ve got a solution to that. Please file an issue in GitHub.
  • l

    Lt. Templeton Peck

    03/24/2025, 1:05 PM
    @Alexander Ioffe I've opened some PR's for Kotlin 2.1.20
    kodee happy 2
    👍 1
  • a

    Alexander Ioffe

    03/31/2025, 12:22 PM
    Thanks for the PRs! I bumped it up to 2.1.20. As usual they changed the upstream API in some small ways so I had to do a few additional things.
    kodee loving 3
  • a

    Alexander Ioffe

    04/29/2025, 1:09 PM
    Using the Terpal-SQL components that I built, I created a new library that does Language Integrated Query for Kotlin. Have a look at the anncouncement! https://kotlinlang.slack.com/archives/D052H47Q2DS/p1745918278461209
    🎉 2
    👀 1
  • a

    Alexander Ioffe

    04/29/2025, 1:10 PM

    https://www.youtube.com/watch?v=6DgCLeu8In8▾

    🚀 1
    👀 2
  • a

    Alexander Ioffe

    05/21/2025, 2:30 PM
    (moved from https://kotlinlang.slack.com/archives/C0BJ0GTE2/p1747831930795309) Hey @phldavies. So I use both Terpal and Terpal-SQL in ExoQuery so I'll need to keep versioning both for upcoming Kotlin versions.
    p
    c
    • 3
    • 27
  • c

    Cies

    06/14/2025, 10:37 AM
    I've recently tested SQLDelight, Jdbi and terpal-sql to pick one for a new project. I found that SQLDelight -- unlike the others -- does not allow me to use all of SQL, but only the subset they support. They also have trouble keeping their IntelliJ plugin up-to-date (their backing company clearly does not devote the resources to it to keep it current). Jdbi and terpal-sql are truly "just SQL" libs, and thus allow me to write any SQL Postgres can handle. terpal-sql was BY FAR the smallest option in terms of added dependency size. Since it builds on kotlinx.serialization I have moved some other code over to use that JSON lib as well, so I could remove all Moshi/Jackson/kotlin-reflect usage, and drop the total stack size dramatically.
    Copy code
    1683 KB  kotlin-stdlib-2.1.20.jar
      1510 KB  kotlinx-coroutines-core-jvm-1.8.1.jar
      1063 KB  postgresql-42.7.3.jar
       865 KB  kotlinx-html-jvm-0.11.0.jar
       836 KB  http4k-core-6.9.2.0.jar
       771 KB  okhttp-4.12.0.jar
       648 KB  kotlinx-datetime-jvm-0.6.0.jar
       382 KB  kotlinx-serialization-core-jvm-1.8.1.jar
       351 KB  okio-jvm-3.6.0.jar
       288 KB  config-1.4.1.jar
       270 KB  supabase-http4k.jar
       270 KB  kotlinx-serialization-json-jvm-1.8.1.jar
       246 KB  terpal-sql-core-jvm-2.0.0.PL-1.2.0.jar
       225 KB  checker-qual-3.42.0.jar
       198 KB  terpal-sql-jdbc-jvm-2.0.0.PL-1.2.0.jar
       198 KB  http4k-realtime-core-6.9.2.0.jar
       158 KB  HikariCP-5.1.0.jar
       148 KB  konform-jvm-0.11.0.jar
       106 KB  kotlin-logging-jvm-7.0.7.jar
        96 KB  http4k-format-core-6.9.2.0.jar
        68 KB  slf4j-api-2.0.17.jar
        59 KB  http4k-config-6.9.2.0.jar
        56 KB  http4k-format-kotlinx-serialization-6.9.2.0.jar
        35 KB  atomicfu-jvm-0.23.1.jar
        29 KB  annotations-24.1.0.jar
        28 KB  http4k-client-okhttp-6.9.2.0.jar
        27 KB  result4k-2.22.3.0.jar
        22 KB  terpal-runtime-jvm-2.1.0-2.0.0.PL.jar
        15 KB  slf4j-simple-2.0.17.jar
         0 KB  kotlin-stdlib-jdk8-1.9.10.jar
         0 KB  kotlin-stdlib-jdk7-1.9.10.jar
    ---------------
    TOTAL: 11M build/distributions/supabase-http4k.tar
  • c

    Cies

    06/14/2025, 10:42 AM
    That's one lean and mean request responding machine 🙂 The code is here https://github.com/cies/supabase-http4k-terpal-ssr-example if anyone has a look, I much welcome your feedback!
  • c

    Cies

    06/14/2025, 10:43 AM
    (I also published a "terpal-jvm example". not as interesting though, but I could not find an example like it, so made it myself: https://github.com/cies/terpal-sql-jvm-example )
  • c

    Cies

    06/14/2025, 10:45 AM
    I also have a question, that I've made an issue for (i only found out about this channel after). Here the link: https://github.com/ExoQuery/terpal-sql/issues/10
  • c

    Cies

    06/14/2025, 10:46 AM
    And here the question text itself: What is the equivalent of these "db scopes" in Jdbi and JDBC, in terpal-sql?
    Copy code
    jdbi.open().use { db ->
        val orgDao = dbtx.attach(OrganizationDao::class.java)
        val orgs = orgDao.listOrganizations()
        // ...
    }
    Copy code
    db.database.connection.use { jdbc ->
         jdbc.prepareStatement("....").execute()
    }
    Are these connections? Or sessions? Or transactions? (nah, they are for sure not transactions; transactions are opened in a different way)
  • a

    arve

    07/26/2025, 11:02 PM
    Hi, I seem to be unable to do batch insert with Flow<T>. I tried the attached example, from README, and it complains that there is no overload function for
    .values(Flow<T>)
    Am I missing something?