CaseBuilder

interface CaseBuilder

DSL builder for constructing the branches of a CASE expression.

This interface provides the syntax for defining WHEN conditions, their corresponding THEN results, and an optional ELSE fallback.

Example:

select(
id,
name,
salary,
CASE {
WHEN { salary LT 50000 } THEN "Low"
WHEN { salary BETWEEN (50000..100000) } THEN "Medium"
ELSE("High")
} AS "salary_group",
).from(employees).execute()

Author

MOHAMMAD AZIM ANSARI

See also

Functions

Link copied to clipboard
abstract fun ELSE(value: Any?)
Link copied to clipboard
abstract infix fun WhenBlock.THEN(value: Any?)
Link copied to clipboard
abstract fun WHEN(clause: Clause.() -> Unit): WhenBlock