Adam Jarvis
06/05/2025, 4:24 PMwhere
to be closer to andWhere
?
fun where(predicate: Op<Boolean>): Query {
where?.let {
error("WHERE clause is specified twice. Old value = '$it', new value = '$predicate'")
}
where = predicate
return this
}
^ to me, I end up just using andWhere
everywhere because of the built in handling of chaining
fun Query.andWhere(andPart: SqlExpressionBuilder.() -> Op<Boolean>) = adjustWhere {
val expr = Op.build { andPart() }
if (this == null) expr else this and expr
}
Why always throwing the error for chaining where
?Luis Arcos
06/06/2025, 2:29 PMwhere
is make the code look more like SQL, so no chaining is necessary.
.where {
(StudentAdvisorTable.institutionId eq institutionId)
.and(StudentAdvisorTable.advisorId eq advisorId)
}