CaseWhere

class CaseWhere<T : Any> : Where<T> (source)

A SQL CASE WHEN <disc> = ? THEN <pred> [...] [ELSE <pred>] END expression usable as a top-level Where.

Each branch holds its own Where predicate. At lowering time, branch predicates emit scalar SQL via Where.toScalarSqlValue so they compose inside the CASE without LATERAL json_tree joins.

Variants/values not listed are excluded — unmatched rows fall through to SQL NULL (falsy in WHERE). Use default { ... } for an explicit ELSE.

Functions

Link copied to clipboard
infix fun <T : Any> Where<T>.and(other: Where<T>): Where<T>

Equivalent to AND in SQL

Link copied to clipboard
infix fun <T : Any> Where<T>.or(other: Where<T>): Where<T>

Equivalent to OR in SQL

Link copied to clipboard
open override fun toScalarSqlValue(): SqlValueFragment

Emits a scalar boolean SQL fragment using json_extract (no LATERAL joins). Used when this Where appears inside a CASE expression branch where row-level dispatch is required.

Link copied to clipboard
open override fun toSqlQuery(increment: Int): SqlQuery