WHERE (a.name, a.uuid) > (prev.name, prev.uuid) ORDER BY a.name, a.uuid
S.
12/07/2023, 11:10 PM
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
S.
12/07/2023, 11:28 PM
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(")")
}
}
}