Function cel_interpreter::functions::exists

source ·
pub fn exists(
    ftx: &FunctionContext<'_>,
    This: This<Value>,
    ident: Identifier,
    expr: Expression,
) -> Result<bool, ExecutionError>
Expand description

Returns a boolean value indicating whether a or more values in the provided list or map meet the predicate defined by the provided expression. If called on a map, the predicate is applied to the map keys.

This function is intended to be used like the CEL-go exists macro: https://github.com/google/cel-spec/blob/master/doc/langdef.md#macros

§Example

[1, 2, 3].exists(x, x > 0) == true
[{1:true, 2:true, 3:false}].exists(x, x > 0) == true