caseWhen function

MssqlExpression caseWhen(
  1. Iterable<MssqlCaseBranch> branches, {
  2. MssqlExpression? otherwise,
  3. MssqlColumnType? type,
})

CASE WHEN … THEN … ELSE … END.

type states what the result is in SQL, for a projection that has to decode it. It is optional because SQL Server resolves a CASE by type precedence across every branch, which this does not try to reimplement.

Implementation

MssqlExpression caseWhen(
  Iterable<MssqlCaseBranch> branches, {
  MssqlExpression? otherwise,
  MssqlColumnType? type,
}) => MssqlCase(branches, otherwise: otherwise, type: type);