Skip to content

Commit a02233d

Browse files
committed
chore: exoquery 2.0 changes
1 parent eea6b93 commit a02233d

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

backend/jvm/src/main/kotlin/dev/suresh/db/Query.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ data class Robot(
3131
val name: String,
3232
)
3333

34-
typealias sql = capture
35-
3634
// Applicative capture
3735
val people = sql { Table<People>() }
3836
val address = sql { Table<Address>() }
@@ -60,7 +58,7 @@ val distinct = sql { people.map { it.name to it.age }.distinct() }
6058
val limitAndOffest = sql { people.drop(1).take(10) }
6159

6260
val union = sql {
63-
people.filter { it.name.like("aaa%").use } union people.filter { it.name.like("bbb%").use }
61+
people.filter { it.name.like("aaa%") } union people.filter { it.name.like("bbb%") }
6462
}
6563

6664
data class CommonType(val id: Long, val name: String)
@@ -74,7 +72,7 @@ fun select() {
7472
val s =
7573
sql.select {
7674
val p = from(people)
77-
val a = join(address) { it.id == p.addressId && it.city.like("%San Francisco%").use }
75+
val a = join(address) { it.id == p.addressId && it.city.like("%San Francisco%") }
7876
where { p.age > 10 }
7977
groupBy(p.name, p.age)
8078
having { p95(p.age).use > 50 }
@@ -117,12 +115,11 @@ fun batch(p: Sequence<People>) {
117115
sql.batch(p) { p -> insert<People> { setParams(p).excluding(id) } }
118116
}
119117

120-
@CapturedFunction
121-
// context(_: CapturedBlock)
118+
@SqlFragment
122119
fun String.like(value: String) =
123-
capture.expression { free("${this@like} LIKE $value").asPure<Boolean>() }
120+
sql.expression { free("${this@like} LIKE $value").asPure<Boolean>() }
124121

125-
@CapturedFunction fun p95(measure: Int) = sql.expression { avg(measure) + 1.645 * stddev(measure) }
122+
@SqlFragment fun p95(measure: Int) = sql.expression { avg(measure) + 1.645 * stddev(measure) }
126123

127124
// data class User(val id: Long, val name: String, val active: Int)
128125
//

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ kotlinx-fuzz = "0.2.2"
3838
kotlinx-metadata = "0.9.0"
3939
kotlinx-reflect-lite = "1.2.0-RC"
4040
kotlin-lincheck = "3.3.2"
41-
kotlin-wrappers = "2025.11.7"
41+
kotlin-wrappers = "2025.11.8"
4242
kotlin-redacted = "1.15.0"
4343
kotlin-serviceloader = "0.0.21"
4444
kotlinx-multik = "0.2.3"
@@ -47,8 +47,8 @@ kotlinx-kandy = "0.9.0-dev-86"
4747
kotlin-statistics = "0.4.0-RC1"
4848
kotlin-base32 = "1.0.0"
4949
gradle-kotlin-dsl = "6.4.2"
50-
exoquery-plugin = "2.2.20-1.7.2.PL"
51-
exoquery-sql = "1.7.2.PL"
50+
exoquery-plugin = "2.2.20-2.0.0.PL.RC1"
51+
exoquery-sql = "2.0.0.PL.RC1"
5252
exposed = "1.0.0-rc-3"
5353
postgresql = "42.7.8"
5454
embedded-postgres = "2.1.1"
@@ -210,7 +210,7 @@ voices = "0.0.8"
210210
onnx = "1.23.2"
211211
angus-mail = "2.1.0-M1"
212212
simplemail = "8.12.6"
213-
javelit = "0.68.0"
213+
javelit = "0.69.0"
214214

215215
# Compose
216216
compose = "1.10.0-beta01"
@@ -275,7 +275,7 @@ badass-runtime = "2.0.1"
275275
badass-jlink = "3.1.4-rc"
276276
jlink-jib = "0.5.1"
277277
jextract = "1.1.0"
278-
maven-plugin-api = "4.0.0-rc-4"
278+
maven-plugin-api = "4.0.0-rc-5"
279279
maven-plugin-annotations = "3.15.1"
280280
gradlex-maven-plugin = "1.0.3"
281281
typesafe-conventions = "0.10.0"

0 commit comments

Comments
 (0)