All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.komapper.r2dbc.dsl.runner.R2dbcSetOperationFlowBuilder.kt Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
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.SetOperationContext
import org.komapper.core.dsl.runner.SetOperationRunner
import org.komapper.r2dbc.R2dbcDataOperator
import org.komapper.r2dbc.R2dbcDatabaseConfig
import org.komapper.r2dbc.R2dbcExecutor

internal class R2dbcSetOperationFlowBuilder(
    private val context: SetOperationContext,
    private val transform: (R2dbcDataOperator, Row) -> T,
) : R2dbcFlowBuilder {
    private val runner: SetOperationRunner = SetOperationRunner(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