Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frameworks/Kotlin/ktor/ktor-exposed-dao.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM gradle:jdk17
WORKDIR /ktor-exposed
COPY ktor-exposed/settings.gradle.kts settings.gradle.kts
COPY ktor-exposed/app app
RUN gradle shadowJar
RUN gradle --no-daemon shadowJar

EXPOSE 8080

Expand Down
2 changes: 1 addition & 1 deletion frameworks/Kotlin/ktor/ktor-exposed-dsl.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM gradle:jdk17
WORKDIR /ktor-exposed
COPY ktor-exposed/settings.gradle.kts settings.gradle.kts
COPY ktor-exposed/app app
RUN gradle shadowJar
RUN gradle --no-daemon shadowJar

EXPOSE 8080

Expand Down
2 changes: 1 addition & 1 deletion frameworks/Kotlin/ktor/ktor-exposed/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {

val ktorVersion = "2.3.12"
val kotlinxSerializationVersion = "1.6.3"
val exposedVersion = "0.52.0"
val exposedVersion = "0.56.0"

dependencies {
implementation("io.ktor:ktor-server-core:$ktorVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.dao.id.IdTable
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.Transaction
import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update
import java.util.concurrent.ThreadLocalRandom

@Serializable
Expand Down Expand Up @@ -82,7 +85,7 @@ fun Application.module(exposedMode: ExposedMode) {

routing {
fun selectWorldsWithIdQuery(id: Int) =
WorldTable.slice(WorldTable.id, WorldTable.randomNumber).select(WorldTable.id eq id)
WorldTable.select(WorldTable.id, WorldTable.randomNumber).where(WorldTable.id eq id)

fun ResultRow.toWorld() =
World(this[WorldTable.id].value, this[WorldTable.randomNumber])
Expand Down Expand Up @@ -129,7 +132,7 @@ fun Application.module(exposedMode: ExposedMode) {
get("/fortunes") {
val result = withDatabaseContextAndTransaction {
when (exposedMode) {
Dsl -> FortuneTable.slice(FortuneTable.id, FortuneTable.message).selectAll()
Dsl -> FortuneTable.select(FortuneTable.id, FortuneTable.message)
.asSequence().map { it.toFortune() }

Dao -> FortuneDao.all().asSequence().map { it.toFortune() }
Expand Down
Loading