pub struct CaseBuilder { /* private fields */ }Expand description
Fluent builder for SQL CASE expressions (both searched and simple forms).
Created by case() (searched form) or case_of() (simple form). Add branches
with .when() and an optional default with
.else_(). Finalize with .build() to
get an Expr, or .build_expr() for a raw
Expression.
Implementations§
Source§impl CaseBuilder
impl CaseBuilder
Sourcepub fn else_(self, result: Expr) -> Self
pub fn else_(self, result: Expr) -> Self
Set the ELSE result default branch of the CASE expression.
If not called, the CASE expression has no ELSE clause (implicitly NULL when no WHEN matches).
Sourcepub fn build(self) -> Expr
pub fn build(self) -> Expr
Consume this builder and produce an Expr wrapping the CASE expression.
Sourcepub fn build_expr(self) -> Expression
pub fn build_expr(self) -> Expression
Consume this builder and produce the raw Expression::Case AST node.
Use this instead of .build() when you need the
Expression directly rather than an Expr wrapper.
Auto Trait Implementations§
impl Freeze for CaseBuilder
impl RefUnwindSafe for CaseBuilder
impl Send for CaseBuilder
impl Sync for CaseBuilder
impl Unpin for CaseBuilder
impl UnwindSafe for CaseBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more