pub enum CompactFilter {
EqInt {
field: Arc<str>,
value: i64,
},
EqBool {
field: Arc<str>,
value: bool,
},
EqStr {
field: Arc<str>,
value: Arc<str>,
},
IsNull {
field: Arc<str>,
},
IsNotNull {
field: Arc<str>,
},
GtInt {
field: Arc<str>,
value: i64,
},
LtInt {
field: Arc<str>,
value: i64,
},
And(Box<CompactFilter>, Box<CompactFilter>),
Or(Box<CompactFilter>, Box<CompactFilter>),
}Expand description
A compact filter representation for simple equality filters.
Uses less memory than the full Filter enum for common cases:
- Equality on integer fields: 16 bytes vs ~40 bytes
- Equality on string fields with short values: ~32 bytes vs ~56 bytes
Variants§
EqInt
Equality on integer field.
EqBool
Equality on boolean field.
EqStr
Equality on string field.
IsNull
IS NULL check.
IsNotNull
IS NOT NULL check.
GtInt
Greater than on integer field.
LtInt
Less than on integer field.
And(Box<CompactFilter>, Box<CompactFilter>)
AND of two compact filters.
Or(Box<CompactFilter>, Box<CompactFilter>)
OR of two compact filters.
Implementations§
Source§impl CompactFilter
impl CompactFilter
Sourcepub fn eq_int(field: impl Into<Arc<str>>, value: i64) -> Self
pub fn eq_int(field: impl Into<Arc<str>>, value: i64) -> Self
Create an equality filter on an integer field.
Sourcepub fn eq_bool(field: impl Into<Arc<str>>, value: bool) -> Self
pub fn eq_bool(field: impl Into<Arc<str>>, value: bool) -> Self
Create an equality filter on a boolean field.
Sourcepub fn eq_str(field: impl Into<Arc<str>>, value: impl Into<Arc<str>>) -> Self
pub fn eq_str(field: impl Into<Arc<str>>, value: impl Into<Arc<str>>) -> Self
Create an equality filter on a string field.
Sourcepub fn is_not_null(field: impl Into<Arc<str>>) -> Self
pub fn is_not_null(field: impl Into<Arc<str>>) -> Self
Create an IS NOT NULL filter.
Sourcepub fn gt_int(field: impl Into<Arc<str>>, value: i64) -> Self
pub fn gt_int(field: impl Into<Arc<str>>, value: i64) -> Self
Create a greater-than filter on an integer field.
Sourcepub fn lt_int(field: impl Into<Arc<str>>, value: i64) -> Self
pub fn lt_int(field: impl Into<Arc<str>>, value: i64) -> Self
Create a less-than filter on an integer field.
Sourcepub fn to_sql_postgres(&self, param_offset: &mut usize) -> String
pub fn to_sql_postgres(&self, param_offset: &mut usize) -> String
Convert to SQL condition string for PostgreSQL.
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Get the approximate size in bytes.
Trait Implementations§
Source§impl Clone for CompactFilter
impl Clone for CompactFilter
Source§fn clone(&self) -> CompactFilter
fn clone(&self) -> CompactFilter
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 CompactFilter
impl Debug for CompactFilter
Source§impl PartialEq for CompactFilter
impl PartialEq for CompactFilter
impl StructuralPartialEq for CompactFilter
Auto Trait Implementations§
impl Freeze for CompactFilter
impl RefUnwindSafe for CompactFilter
impl Send for CompactFilter
impl Sync for CompactFilter
impl Unpin for CompactFilter
impl UnwindSafe for CompactFilter
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