Skip to main content

WhereInput

Trait WhereInput 

Source
pub trait WhereInput {
    type Model: Model;

    // Required method
    fn into_ir(self) -> Filter;
}
Expand description

A typed shape that lowers to a runtime Filter.

Implemented by per-model UserWhereInput, PostWhereInput, …

§Warning: Default::default() lowers to Filter::None

A *WhereInput constructed via Default::default() (no fields set) produces Filter::None, which lowers to WHERE TRUE — i.e. matches every row. Passing such a filter to delete_many or update_many affects every row in the table. Codegen never refuses this at compile time; if a delete_many / update_many call site needs a non-empty filter, it is the caller’s responsibility to verify the Filter::None case before invoking .exec().

Required Associated Types§

Source

type Model: Model

The model this WHERE shape applies to.

Required Methods§

Source

fn into_ir(self) -> Filter

Lower this input to the runtime IR.

Returns Filter::None when no fields are set. See the trait-level note about the match-all behavior of Filter::None.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§