-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List helper functions #751
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change
I'm looking at whether or not CEL could be used as a DSL for an existing gRPC based query API. For a query API, we may need to operate on a list of objects and perform various operations. Some macros like
filter
,exists
, andmap
already exist for some use-cases, and I would like to see if we could add additional functions that operate on lists.Example
myList.slice(start, end)
could slice a list, much like in Go or Python via:mylist[start:end]
.myList.first(n)
could take the first elements from a list.myList.last(n)
could take the last elements from a list.Any many more could be considered, but at the moment, these 3 are the first ones I'm thinking about.
Alternatives considered
This could be handled outside of CEL, but being able to manipulate lists would be very useful for using CEL in a query language.
I wrote a quick MVP of
list.slice
here: master...chancez:cel-go:pr/chancez/slice_functionThe text was updated successfully, but these errors were encountered: