pub fn case_of(operand: Expr) -> CaseBuilderExpand description
Start building a simple CASE expression (CASE operand WHEN value THEN result ... END).
A simple CASE compares the operand against each WHEN value for equality. Use
case() for a searched CASE with arbitrary boolean conditions.
ยงExamples
use polyglot_sql::builder::*;
let expr = case_of(col("status"))
.when(lit(1), lit("active"))
.when(lit(0), lit("inactive"))
.else_(lit("unknown"))
.build();
assert_eq!(
expr.to_sql(),
"CASE status WHEN 1 THEN 'active' WHEN 0 THEN 'inactive' ELSE 'unknown' END"
);