pub enum JsonFilter {
Show 14 variants
Equals(JsonPath, Value),
NotEquals(JsonPath, Value),
Contains(String, Value),
ContainedBy(String, Value),
HasAnyKey(String, Vec<String>),
HasAllKeys(String, Vec<String>),
HasKey(String, String),
GreaterThan(JsonPath, Value),
LessThan(JsonPath, Value),
Exists(JsonPath),
IsNull(JsonPath),
IsNotNull(JsonPath),
ArrayContains(JsonPath, Value),
PathMatch(String, String),
}Expand description
A JSON filter operation.
Variants§
Equals(JsonPath, Value)
Check if path equals a value.
NotEquals(JsonPath, Value)
Check if path does not equal a value.
Contains(String, Value)
Check if JSON contains another JSON value (PostgreSQL @>).
ContainedBy(String, Value)
Check if JSON is contained by another JSON value (PostgreSQL <@).
HasAnyKey(String, Vec<String>)
Check if any of the keys exist (PostgreSQL ?|).
HasAllKeys(String, Vec<String>)
Check if all of the keys exist (PostgreSQL ?&).
HasKey(String, String)
Check if a key exists (PostgreSQL ?).
GreaterThan(JsonPath, Value)
Check if path value is greater than.
LessThan(JsonPath, Value)
Check if path value is less than.
Exists(JsonPath)
Check if path exists.
IsNull(JsonPath)
Check if path is null.
IsNotNull(JsonPath)
Check if path is not null.
ArrayContains(JsonPath, Value)
Check if array contains value.
PathMatch(String, String)
Check value using JSONPath predicate (PostgreSQL @?).
Implementations§
Source§impl JsonFilter
impl JsonFilter
Sourcepub fn contains(column: impl Into<String>, value: impl Into<JsonValue>) -> Self
pub fn contains(column: impl Into<String>, value: impl Into<JsonValue>) -> Self
Create a contains filter.
Sourcepub fn has_key(column: impl Into<String>, key: impl Into<String>) -> Self
pub fn has_key(column: impl Into<String>, key: impl Into<String>) -> Self
Create a has key filter.
Sourcepub fn to_postgres_sql(&self) -> (String, Vec<FilterValue>)
pub fn to_postgres_sql(&self) -> (String, Vec<FilterValue>)
Generate PostgreSQL SQL for this filter.
Sourcepub fn to_mysql_sql(&self) -> (String, Vec<FilterValue>)
pub fn to_mysql_sql(&self) -> (String, Vec<FilterValue>)
Generate MySQL SQL for this filter.
Sourcepub fn to_sql(
&self,
db_type: DatabaseType,
) -> QueryResult<(String, Vec<FilterValue>)>
pub fn to_sql( &self, db_type: DatabaseType, ) -> QueryResult<(String, Vec<FilterValue>)>
Generate SQL for the specified database.
Trait Implementations§
Source§impl Clone for JsonFilter
impl Clone for JsonFilter
Source§fn clone(&self) -> JsonFilter
fn clone(&self) -> JsonFilter
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 JsonFilter
impl Debug for JsonFilter
Source§impl<'de> Deserialize<'de> for JsonFilter
impl<'de> Deserialize<'de> for JsonFilter
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 PartialEq for JsonFilter
impl PartialEq for JsonFilter
Source§impl Serialize for JsonFilter
impl Serialize for JsonFilter
impl StructuralPartialEq for JsonFilter
Auto Trait Implementations§
impl Freeze for JsonFilter
impl RefUnwindSafe for JsonFilter
impl Send for JsonFilter
impl Sync for JsonFilter
impl Unpin for JsonFilter
impl UnwindSafe for JsonFilter
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