classCaseBranch
final class CaseBranch
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One WHEN condition THEN result branch of a CASE expression.
Mirrors PostgreSQL's CaseWhen node. With a CASE operand the condition is a value compared with the operand. Source: https://www.postgresql.org/docs/17/functions-conditional.html#FUNCTIONS-CASE.
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT CASE WHEN true THEN 1 END');
$query->field(0)->expression->branches[0]->result->value->digits // => '1'Properties§
public Scalar $conditionpublic Scalar $resultMethods§
public function __construct(public Scalar $condition, public Scalar $result)Parameters
$condition | Scalar | The condition, or the value compared with the CASE operand |
$result | Scalar | The result when the branch is taken |
public function render(Output $out): voidWrites WHEN, the condition, THEN and the result.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 41
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.