kysely
    Preparing search index...

    Class CaseWhenBuilder<DB, TB, W, O>

    Type Parameters

    • DB
    • TB extends keyof DB
    • W
    • O

    Implements

    Index

    Constructors

    Methods

    • Adds an else clause to the case statement.

      See elseRef for reference-first variant.

      An else call must be followed by an Endable.end or Endable.endCase call.

      Note: Numbers, booleans, and null values are inlined directly into the SQL query string (e.g. else 0, else false, else null) instead of being added as parameterized values (e.g. else $1). This allows the database engine to correctly infer the data type of the case expression result. Without this behavior, all results would be returned as strings.

      String values are always parameterized as usual.

      Type Parameters

      Parameters

      • expression: E

      Returns CaseEndBuilder<DB, TB, O | ExtractTypeFromValueExpression<E>>

    • Adds an else clause to the case statement.

      See elseRef for reference-first variant.

      An else call must be followed by an Endable.end or Endable.endCase call.

      Note: Numbers, booleans, and null values are inlined directly into the SQL query string (e.g. else 0, else false, else null) instead of being added as parameterized values (e.g. else $1). This allows the database engine to correctly infer the data type of the case expression result. Without this behavior, all results would be returned as strings.

      String values are always parameterized as usual.

      Type Parameters

      • V

      Parameters

      • value: V

      Returns CaseEndBuilder<DB, TB, O | V>