Skip to content

Commit 4abeebc

Browse files
committed
chore: exoquery, misc update and refactorings
1 parent aef4262 commit 4abeebc

File tree

8 files changed

+79
-46
lines changed

8 files changed

+79
-46
lines changed

backend/jvm/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
dev.suresh.plugin.graalvm
1212
com.gradleup.shadow
1313
alias(libs.plugins.jetbrains.ktor)
14-
// alias(libs.plugins.exoquery)
14+
alias(libs.plugins.exoquery)
1515
dev.suresh.plugin.publishing
1616
// alias(libs.plugins.jetbrains.exposed)
1717
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,20 @@ val distinct = sql { people.map { it.name to it.age }.distinct() }
5454

5555
val limitAndOffest = sql { people.drop(1).take(10) }
5656

57-
val union = sql {
58-
people.filter { it.name.startsWith("aaa") } union people.filter { it.name.startsWith("bbb") }
59-
}
57+
val union = sql { people.filter { it.name == "aaa%" } union people.filter { it.name == "bbb%" } }
6058

6159
data class CommonType(val id: Long, val name: String)
6260

6361
// Map to common type and union
64-
val commonTyep = sql {
62+
val commonType = sql {
6563
people.map { CommonType(it.id, it.name) } union robot.map { CommonType(it.id, it.name) }
6664
}
6765

6866
fun select() {
6967
val s =
7068
sql.select {
7169
val p = from(people)
72-
val a = join(address) { a -> a.id == p.addressId }
70+
val a = join(address) { a -> a.id == p.addressId && a.city == "San Francisco%" }
7371
where { p.age > 10 }
7472
groupBy(p.name, p.age)
7573
sortBy(p.name to Ord.Asc, p.age to Ord.Desc)
@@ -93,7 +91,7 @@ fun insert(p: People) {
9391
fun upsert(p: People) {
9492
sql {
9593
insert<People> {
96-
setParams(p).onConflictUpdate(id) { excluding -> set(name to "name" + "-" + excluding.name) }
94+
setParams(p).onConflictUpdate(id) { excluding -> set(name to name + "-" + excluding.name) }
9795
// setParams(p).onConflictIgnore(id) - Do nothing
9896
}
9997
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package dev.suresh
2+
3+
import junit.framework.TestCase.*
4+
import kotlin.concurrent.thread
5+
import org.jetbrains.lincheck.Lincheck
6+
7+
class LincheckTests {
8+
9+
// @Test
10+
fun test() =
11+
Lincheck.runConcurrentTest {
12+
var counter = 0
13+
// Increment the counter concurrently
14+
val t1 = thread { counter++ }
15+
val t2 = thread { counter++ }
16+
// Wait for the threads to finish
17+
t1.join()
18+
t2.join()
19+
// Check both increments have been applied
20+
assertEquals(2, counter)
21+
}
22+
}

gradle/build-logic/src/main/kotlin/dev.suresh.plugin.kotlin.jvm.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ dependencies {
254254
testImplementation(kotlin("reflect"))
255255
testImplementation(kotlin("test-junit5"))
256256
testImplementation(libs.junit.jupiter)
257-
testImplementation(libs.kotlinx.lincheck)
257+
testImplementation(libs.kotlin.lincheck)
258258
testImplementation(libs.kotlinx.coroutines.test)
259259
testImplementation(libs.mockk)
260260
// testImplementation(libs.slf4j.simple)

gradle/kotlin-js-store/package-lock.json

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradle/kotlin-js-store/wasm/package-lock.json

Lines changed: 16 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)