Skip to main content

CaseInit

Struct CaseInit 

Source
pub struct CaseInit<'a, V: SQLParam> { /* private fields */ }
Expand description

Builder state before the first WHEN branch.

The result type is not yet known — it will be set by the first .when().

Implementations§

Source§

impl<'a, V: SQLParam + 'a> CaseInit<'a, V>

Source

pub fn when<C, R>( self, condition: C, result: R, ) -> CaseBuilder<'a, V, R::SQLType, R::Nullable, <C::Aggregate as AggOr<R::Aggregate>>::Output>
where C: Expr<'a, V>, R: Expr<'a, V>, C::SQLType: BooleanLike, C::Aggregate: AggOr<R::Aggregate>,

Add the first WHEN branch. This establishes the result type.

case().when(gt(users.age, 65), "Senior")
// Type T = Text, Nullability N = NonNull (from &str literal)

Auto Trait Implementations§

§

impl<'a, V> Freeze for CaseInit<'a, V>
where V: Freeze,

§

impl<'a, V> RefUnwindSafe for CaseInit<'a, V>
where V: RefUnwindSafe,

§

impl<'a, V> Send for CaseInit<'a, V>
where V: Send + Sync,

§

impl<'a, V> Sync for CaseInit<'a, V>
where V: Sync,

§

impl<'a, V> Unpin for CaseInit<'a, V>
where V: Unpin,

§

impl<'a, V> UnsafeUnpin for CaseInit<'a, V>
where V: UnsafeUnpin,

§

impl<'a, V> UnwindSafe for CaseInit<'a, V>

Blanket Implementations§

Source§

impl<T> AliasExt for T

Source§

fn alias(self, name: &'static str) -> AliasedExpr<Self>

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Mk> MarkerAggValidFor<()> for Mk

Source§

impl<Scope> ScopeSatisfies<Nil, ()> for Scope

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeEq<T> for T