Skip to content

Add ability to define custom predicate functions #497

@neetle

Description

@neetle

Hi!

I'm currently working on a project that would like to use this as the primary language to build filters for it's frontend.

At the moment, we're hoping to allow users to write queries like Nodes | filter(.Name=="cat"). We're currently facing an issue though, as Nodes isn't a slice. This leads to issues like array.Len() causing panics in the VM every time we hit an OpBegin.

As we don't control the layout/go type of the data we're passing into expr, would you be against defining some way to implement functions that take custom predicates?

Looking forwards, this could also be a good place to look into support for the changes proposed in golang/go#61898.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions