Is it currently possible to use <Row Constructor C...
# komapper
s
Is it currently possible to use Row Constructor Comparison ?
Copy code
WHERE (a.name, a.uuid) > (prev.name, prev.uuid) ORDER BY a.name, a.uuid
I'm not sure how I could implement this as a custom comparison operator, since I would need something like a Pair or a list as the receiver rather than a single ColumnExpression
oh nvm, I figured it out
Copy code
class KomapperExtensions(private val context: CriteriaContext) {
    infix fun <A : Any, B : Any, C : Any, D: Any> Pair<ColumnExpression<A, B>, ColumnExpression<C, D>>.greater(pair: Pair<A, C>) {
        val o1 = Operand.Column(this.first)
        val o2 = Operand.Column(this.second)
        val arg1 = Operand.Argument(first, pair.first)
        val arg2 = Operand.Argument(second, pair.second)
        context.add {
            append("(")
            visit(o1)
            append(", ")
            visit(o2)
            append(") > (")
            visit(arg1)
            append(", ")
            visit(arg2)
            append(")")
        }
    }
}
đź‘Ť 1
t
Yes, that’s right!