Function cel_interpreter::functions::exists_one
source · pub fn exists_one(
ftx: &FunctionContext<'_>,
This: This<Value>,
ident: Identifier,
expr: Expression,
) -> Result<bool, ExecutionError>Expand description
Returns a boolean value indicating whether only one value in the provided list or map meets 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_one(x, x > 0) == false
[1, 2, 3].exists_one(x, x == 1) == true
[{1:true, 2:true, 3:false}].exists_one(x, x > 0) == false