org.komapper.r2dbc.dsl.runner.R2dbcValueExtractor.kt Maven / Gradle / Ivy
package org.komapper.r2dbc.dsl.runner
import io.r2dbc.spi.Row
import org.komapper.core.dsl.expression.ColumnExpression
import org.komapper.core.dsl.runner.ValueExtractor
import org.komapper.r2dbc.R2dbcDataOperator
internal interface R2dbcValueExtractor {
fun execute(expression: ColumnExpression): EXTERIOR?
}
internal class R2dbcIndexedValueExtractor(private val dataOperator: R2dbcDataOperator, private val row: Row) : R2dbcValueExtractor {
private var index = 0
override fun execute(expression: ColumnExpression): EXTERIOR? {
return ValueExtractor.getByIndex(expression, index) {
dataOperator.getValue(row, index++, expression.interiorType)
}
}
}
internal class R2dbcNamedValueExtractor(private val dataOperator: R2dbcDataOperator, private val row: Row) : R2dbcValueExtractor {
override fun execute(expression: ColumnExpression): EXTERIOR? {
return ValueExtractor.getByName(expression) {
dataOperator.getValue(row, expression.columnName, expression.interiorType)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy