org.komapper.r2dbc.dsl.runner.R2dbcEntityUpsertRunnerSupport.kt Maven / Gradle / Ivy
package org.komapper.r2dbc.dsl.runner
import org.komapper.core.dsl.context.EntityUpsertContext
import org.komapper.core.dsl.metamodel.EntityMetamodel
import org.komapper.core.dsl.runner.EntityUpsertRunnerSupport
import org.komapper.r2dbc.R2dbcDatabaseConfig
import org.komapper.r2dbc.R2dbcExecutor
internal class R2dbcEntityUpsertRunnerSupport>(
context: EntityUpsertContext,
) {
private val runner: EntityUpsertRunnerSupport = EntityUpsertRunnerSupport(context)
private val support: R2dbcEntityInsertRunnerSupport =
R2dbcEntityInsertRunnerSupport(context.insertContext)
suspend fun preUpsert(config: R2dbcDatabaseConfig, entity: ENTITY): ENTITY {
return support.preInsert(config, entity)
}
suspend fun upsert(config: R2dbcDatabaseConfig, usesGeneratedKeys: Boolean, execute: suspend (R2dbcExecutor) -> T): T {
return support.insert(config, usesGeneratedKeys, execute)
}
fun postInsert(entity: ENTITY, generatedKey: Long): ENTITY {
return runner.postInsert(entity, generatedKey)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy