org.komapper.r2dbc.dsl.runner.R2dbcEntityDeleteSingleRunner.kt Maven / Gradle / Ivy
package org.komapper.r2dbc.dsl.runner
import org.komapper.core.DatabaseConfig
import org.komapper.core.DryRunStatement
import org.komapper.core.dsl.context.EntityDeleteContext
import org.komapper.core.dsl.metamodel.EntityMetamodel
import org.komapper.core.dsl.runner.EntityDeleteSingleRunner
import org.komapper.r2dbc.R2dbcDatabaseConfig
internal class R2dbcEntityDeleteSingleRunner>(
context: EntityDeleteContext,
entity: ENTITY,
) : R2dbcRunner {
private val runner: EntityDeleteSingleRunner =
EntityDeleteSingleRunner(context, entity)
private val support: R2dbcEntityDeleteRunnerSupport =
R2dbcEntityDeleteRunnerSupport(context)
override fun check(config: DatabaseConfig) {
runner.check(config)
}
override suspend fun run(config: R2dbcDatabaseConfig) {
val (count) = delete(config)
postDelete(count)
}
private suspend fun delete(config: R2dbcDatabaseConfig): Pair> {
val statement = runner.buildStatement(config)
return support.delete(config) { it.executeUpdate(statement) }
}
private fun postDelete(count: Long) {
runner.postDelete(count)
}
override fun dryRun(config: DatabaseConfig): DryRunStatement {
return runner.dryRun(config)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy