pub struct QueryFilterCondition {
pub operator: QueryFilterOperator,
pub value: Option<String>,
}Expand description
Represents a complete filter condition with operator and value(s).
This structure encapsulates a filtering operation, including the operator and the value(s) to compare against. It’s used internally to build type-safe SQL WHERE conditions.
Fields§
§operator: QueryFilterOperatorThe comparison operator to use
value: Option<String>The value(s) to compare against
- For most operators: single value (e.g., “10”, “active”)
- For IN/NOT IN: comma-separated values (e.g., “admin,moderator,user”)
- For IS NULL/IS NOT NULL: ignored (can be None)
Implementations§
Source§impl QueryFilterCondition
impl QueryFilterCondition
Sourcepub fn new(
operator: QueryFilterOperator,
value: Option<impl Into<String>>,
) -> Self
pub fn new( operator: QueryFilterOperator, value: Option<impl Into<String>>, ) -> Self
Creates a new filter condition.
§Arguments
operator- The comparison operatorvalue- The value to compare against (None for IS NULL/IS NOT NULL)
Sourcepub fn greater_than(value: impl Into<String>) -> Self
pub fn greater_than(value: impl Into<String>) -> Self
Creates a greater than filter condition.
Sourcepub fn greater_or_equal(value: impl Into<String>) -> Self
pub fn greater_or_equal(value: impl Into<String>) -> Self
Creates a greater or equal filter condition.
Sourcepub fn less_or_equal(value: impl Into<String>) -> Self
pub fn less_or_equal(value: impl Into<String>) -> Self
Creates a less or equal filter condition.
Sourcepub fn not_in_list(values: Vec<impl Into<String>>) -> Self
pub fn not_in_list(values: Vec<impl Into<String>>) -> Self
Creates a NOT IN filter condition.
Sourcepub fn is_not_null() -> Self
pub fn is_not_null() -> Self
Creates an IS NOT NULL filter condition.
Sourcepub fn split_values(&self) -> Vec<String>
pub fn split_values(&self) -> Vec<String>
Splits the value into a vector for IN/NOT IN operations.
Trait Implementations§
Source§impl Clone for QueryFilterCondition
impl Clone for QueryFilterCondition
Source§fn clone(&self) -> QueryFilterCondition
fn clone(&self) -> QueryFilterCondition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QueryFilterCondition
impl Debug for QueryFilterCondition
Source§impl<'de> Deserialize<'de> for QueryFilterCondition
impl<'de> Deserialize<'de> for QueryFilterCondition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&str> for QueryFilterCondition
impl From<&str> for QueryFilterCondition
Source§impl From<String> for QueryFilterCondition
impl From<String> for QueryFilterCondition
Auto Trait Implementations§
impl Freeze for QueryFilterCondition
impl RefUnwindSafe for QueryFilterCondition
impl Send for QueryFilterCondition
impl Sync for QueryFilterCondition
impl Unpin for QueryFilterCondition
impl UnwindSafe for QueryFilterCondition
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
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