org.komapper.r2dbc.dsl.runner.R2dbcSelectFlowBuilder.kt Maven / Gradle / Ivy
package org.komapper.r2dbc.dsl.runner
import io.r2dbc.spi.Row
import kotlinx.coroutines.flow.Flow
import org.komapper.core.DatabaseConfig
import org.komapper.core.DryRunStatement
import org.komapper.core.dsl.context.SelectContext
import org.komapper.core.dsl.runner.SelectRunner
import org.komapper.r2dbc.R2dbcDataOperator
import org.komapper.r2dbc.R2dbcDatabaseConfig
import org.komapper.r2dbc.R2dbcExecutor
internal class R2dbcSelectFlowBuilder(
private val context: SelectContext<*, *, *>,
private val transform: (R2dbcDataOperator, Row) -> T,
) :
R2dbcFlowBuilder {
private val runner: SelectRunner = SelectRunner(context)
override fun check(config: DatabaseConfig) {
runner.check(config)
}
override fun build(config: R2dbcDatabaseConfig): Flow {
val statement = runner.buildStatement(config)
val executor = R2dbcExecutor(config, context.options)
return executor.executeQuery(statement, transform)
}
override fun dryRun(config: DatabaseConfig): DryRunStatement {
return runner.dryRun(config)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy