Skip to content

Commit

Permalink
♻️ Bytt fra ? til named parameters i CommandContextDao
Browse files Browse the repository at this point in the history
  • Loading branch information
havstein authored Apr 13, 2024
1 parent de27032 commit 4c0026f
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,20 @@ internal class CommandContextDao(private val dataSource: DataSource) {
sessionOf(dataSource).use {
@Language("PostgreSQL")
val query =
"""INSERT INTO command_context(context_id,hendelse_id,tilstand,data,hash) VALUES (?, ?, ?, ?::json, ?)"""
"""
INSERT INTO command_context(context_id, hendelse_id, tilstand, data, hash)
VALUES (:contextId, :hendelseId, :tilstand, :data::json, :hash)
""".trimIndent()
it.run(
queryOf(
query,
contextId,
hendelseId,
tilstand.name,
mapper.writeValueAsString(CommandContextDto(sti)),
hash,
mapOf(
"contextId" to contextId,
"hendelseId" to hendelseId,
"tilstand" to tilstand.name,
"data" to mapper.writeValueAsString(CommandContextDto(sti)),
"hash" to hash,
),
).asExecute,
)
}
Expand Down

0 comments on commit 4c0026f

Please sign in to comment.