#[non_exhaustive]pub enum Operator {
Show 15 variants
Eq,
Ne,
Gt,
Gte,
Lt,
Lte,
In,
NotIn,
Regex,
Like,
ILike,
StartsWith,
EndsWith,
Contains,
Between,
}Expand description
SQL comparison operators.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Eq
Equal: =
Ne
Not equal: !=
Gt
Greater than: >
Gte
Greater than or equal: >=
Lt
Less than: <
Lte
Less than or equal: <=
In
In array: IN or = ANY
NotIn
Not in array: NOT IN or != ALL
Regex
Regex match: ~ (Postgres) or LIKE (SQLite)
Like
Pattern match: LIKE
ILike
Case-insensitive pattern match: ILIKE (Postgres) or LIKE (SQLite)
StartsWith
String starts with: LIKE $1 || '%'
EndsWith
String ends with: LIKE '%' || $1
Contains
String contains: LIKE '%' || $1 || '%'
Between
Between two values: BETWEEN $1 AND $2
Implementations§
Source§impl Operator
impl Operator
Sourcepub fn from_mongo(s: &str) -> Option<Self>
pub fn from_mongo(s: &str) -> Option<Self>
Parse from Mongo-style operator string (e.g., “$eq”, “$gte”).
Accepts both with and without the $ prefix.
§Example
use mik_sql::Operator;
assert_eq!(Operator::from_mongo("$eq"), Some(Operator::Eq));
assert_eq!(Operator::from_mongo("gte"), Some(Operator::Gte));
assert_eq!(Operator::from_mongo("$unknown"), None);Trait Implementations§
impl Copy for Operator
impl Eq for Operator
impl StructuralPartialEq for Operator
Auto Trait Implementations§
impl Freeze for Operator
impl RefUnwindSafe for Operator
impl Send for Operator
impl Sync for Operator
impl Unpin for Operator
impl UnwindSafe for Operator
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