[jOOQ/jOOQ#13752] Returning null from transactionCoroutine throws NoSuchElementException
This commit is contained in:
parent
0450b0c00f
commit
f0a7b51b30
@ -1,6 +1,6 @@
|
||||
package org.jooq.kotlin.coroutines
|
||||
|
||||
import kotlinx.coroutines.reactive.awaitFirst
|
||||
import kotlinx.coroutines.reactive.awaitFirstOrNull
|
||||
import kotlinx.coroutines.reactor.mono
|
||||
import org.jooq.Configuration
|
||||
import org.jooq.DSLContext
|
||||
@ -10,9 +10,10 @@ import org.jooq.DSLContext
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
suspend fun <T> DSLContext.transactionCoroutine(transactional: suspend (Configuration) -> T): T {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return transactionPublisher { c ->
|
||||
mono {
|
||||
transactional.invoke(c)
|
||||
}
|
||||
}.awaitFirst()
|
||||
}.awaitFirstOrNull() as T
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user