case
Creates a conditional CASE expression builder where each WHEN clause contains an independent boolean condition that is evaluated separately.
This function creates a CASE expression without a comparison value, meaning each WHEN clause will contain its own boolean condition. The conditions are evaluated in order until the first one that evaluates to true
is found, and its corresponding result is returned.
Example usage:
case()
.When(Users.age greater 18, "adult")
.When(Users.age greater 13, "teenager")
.Else("child")
Return
A Case builder instance for creating conditional CASE expressions
Samples
org.jetbrains.exposed.v1.tests.shared.dml.ConditionsTests.nullOpInCaseTestCreates a value-based CASE expression builder that compares a specific value against different conditions in each WHEN clause.
This function creates a CASE expression with a comparison value, where each WHEN clause specifies a value or expression to compare against the provided value. The first matching condition determines the result that is returned.
Example usage:
case(Users.status)
.When("ACTIVE", stringParam("User is active"))
.When("INACTIVE", "User is inactive")
.Else("Unknown status")
Return
A ValueCase builder instance for creating value-based CASE expressions
Parameters
The type of the value being compared
The expression whose value will be compared against WHEN conditions