pub enum JsonFilter {
Contains(Json),
Extract(String, JsonCmp),
HasKey(String),
}Expand description
JSON-specific filter operations.
Provides three types of filtering on JSON columns:
- Contains: Structural containment check (PostgreSQL
@>style) - Extract: Extract value at path and apply comparison
- HasKey: Check if a path exists in the JSON
Variants§
Contains(Json)
Structural containment: column’s JSON contains the pattern.
Implements PostgreSQL @> style containment:
- Objects: all key-value pairs in pattern exist in target (recursive)
- Arrays: all elements in pattern exist in target (order-independent)
- Primitives: must be equal
Extract(String, JsonCmp)
Extract a value at the specified JSON path and apply a comparison operation.
Paths use dot notation with bracket array indices: user.items[0].name
HasKey(String)
Check whether a path/key exists in the JSON structure.
Paths use dot notation with bracket array indices: user.items[0].name
Implementations§
Source§impl JsonFilter
impl JsonFilter
Sourcepub fn matches(&self, json: &Json) -> QueryResult<bool>
pub fn matches(&self, json: &Json) -> QueryResult<bool>
Sourcepub fn extract_eq(path: &str, value: Value) -> Self
pub fn extract_eq(path: &str, value: Value) -> Self
Creates an Extract filter with an equality comparison.
Sourcepub fn extract_ne(path: &str, value: Value) -> Self
pub fn extract_ne(path: &str, value: Value) -> Self
Creates an Extract filter with a not-equal comparison.
Sourcepub fn extract_gt(path: &str, value: Value) -> Self
pub fn extract_gt(path: &str, value: Value) -> Self
Creates an Extract filter with a greater-than comparison.
Sourcepub fn extract_lt(path: &str, value: Value) -> Self
pub fn extract_lt(path: &str, value: Value) -> Self
Creates an Extract filter with a less-than comparison.
Sourcepub fn extract_ge(path: &str, value: Value) -> Self
pub fn extract_ge(path: &str, value: Value) -> Self
Creates an Extract filter with a greater-than-or-equal comparison.
Sourcepub fn extract_le(path: &str, value: Value) -> Self
pub fn extract_le(path: &str, value: Value) -> Self
Creates an Extract filter with a less-than-or-equal comparison.
Sourcepub fn extract_in(path: &str, values: Vec<Value>) -> Self
pub fn extract_in(path: &str, values: Vec<Value>) -> Self
Creates an Extract filter with an In comparison.
Sourcepub fn extract_is_null(path: &str) -> Self
pub fn extract_is_null(path: &str) -> Self
Creates an Extract filter checking for null.
Sourcepub fn extract_not_null(path: &str) -> Self
pub fn extract_not_null(path: &str) -> Self
Creates an Extract filter checking for not null.
Trait Implementations§
Source§impl CandidType for JsonFilter
impl CandidType for JsonFilter
Source§impl Clone for JsonFilter
impl Clone for JsonFilter
Source§fn clone(&self) -> JsonFilter
fn clone(&self) -> JsonFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more