jean-paul
12/29/2023, 6:05 PMjean-paul
12/29/2023, 6:14 PMsuspend fun <T> dbQuery(block: suspend () -> T): T =
newSuspendedTransaction(<http://Dispatchers.IO|Dispatchers.IO>) { block()}
but when I called
query {
addLogger(StdOutSqlLogger)
Articles.select {....}
}
I get a receiver type mismatch error. When I do
suspend fun <T> dbQuery(block: suspend () -> T): T =
newSuspendedTransaction(<http://Dispatchers.IO|Dispatchers.IO>) {
addLogger(StdOutSqlLogger)
block()
}
I don't get the error. Is there a way to add the logger only to certain queries?AdamW
12/29/2023, 8:00 PMdbQuery
should take a parameter of Transaction.()
I thinkAdamW
12/29/2023, 8:01 PMsuspend Transaction.() -> T
jean-paul
12/29/2023, 10:15 PM