pub enum JqOperation {
Eq(Value),
Exist,
In(Vec<Value>),
}Expand description
Operations for matching jq query results.
Used with JqExpression to check if a JSON body matches certain criteria.
§Variants
Variants§
Eq(Value)
Match if the jq result equals this value.
Exist
Match if the jq result is non-null (path exists).
In(Vec<Value>)
Match if the jq result is one of these values.
Implementations§
Source§impl JqOperation
impl JqOperation
Sourcepub async fn check<B>(
&self,
filter: &JqExpression,
body: BufferedBody<B>,
) -> PredicateResult<BufferedBody<B>>
pub async fn check<B>( &self, filter: &JqExpression, body: BufferedBody<B>, ) -> PredicateResult<BufferedBody<B>>
Checks if the jq operation matches the body.
Collects the entire body, parses it as JSON, applies the jq filter, and checks if the result satisfies this operation.
Returns Cacheable if the operation is satisfied,
NonCacheable otherwise.
§Caveats
- The entire body is buffered into memory for JSON parsing
- Returns
NonCacheableif the body is not valid JSON
Trait Implementations§
Source§impl Clone for JqOperation
impl Clone for JqOperation
Source§fn clone(&self) -> JqOperation
fn clone(&self) -> JqOperation
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 moreAuto Trait Implementations§
impl Freeze for JqOperation
impl RefUnwindSafe for JqOperation
impl Send for JqOperation
impl Sync for JqOperation
impl Unpin for JqOperation
impl UnwindSafe for JqOperation
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