Function cel_interpreter::functions::filter

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

Filters the provided list by applying an expression to each input item and including the input item in the resulting list, only if the expression returned true.

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

§Example

[1, 2, 3].filter(x, x > 1) == [2, 3]