pub enum Filter {
Eq {
column: String,
value: Value,
},
In {
column: String,
values: Vec<Value>,
},
Contains {
column: String,
value: String,
},
AnyContains {
columns: Vec<String>,
value: String,
},
}Expand description
An extra predicate applied to a query: equality (owner/org scoping,
?field= filters) or membership (id IN (…), e.g. “organisations you belong
to”). Column names are always validated and quoted; values are always bound.
Variants§
Eq
column = value.
In
column IN (values…). An empty set matches no rows.
Contains
column ILIKE '%value%' — a case-insensitive substring match, which is
what a search box means by “search”. The pattern’s own wildcards are
escaped, so a term containing % looks for a per-cent sign.
AnyContains
(c1 ILIKE '%value%' OR c2 ILIKE '%value%' …) — one term against
several columns, which is what a search box over a configured set of
fields means. An empty column list matches no rows.
Implementations§
Source§impl Filter
impl Filter
pub fn eq(column: impl Into<String>, value: impl Into<SqlValue>) -> Self
pub fn in_(column: impl Into<String>, values: Vec<SqlValue>) -> Self
Sourcepub fn in_uuids(column: impl Into<String>, ids: Vec<Uuid>) -> Self
pub fn in_uuids(column: impl Into<String>, ids: Vec<Uuid>) -> Self
Convenience: column IN (…uuids).
pub fn contains(column: impl Into<String>, value: impl Into<String>) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Filter
impl RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnsafeUnpin for Filter
impl UnwindSafe for Filter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more