Skip to content

Combining different CEL expressions into a single expression #593

Discussion options

You must be logged in to vote

@josephschorr We've shied away from merging pre-compiled expressions since this tends to be error prone. I would recommend using the cel.AstToString method to convert your CheckedExpr values to human-readable strings that you stitch together with &&, ||, and ! before recompiling the combined expression. The only drawback of this approach is that it requires you to have setup the cel.NewEnv() in a way that makes it possible to stitch these expressions together and compile them again.

Your other alternative is to create aliases for the compiled expressions, e.g. lazyExprs map[string]cel.Ast and implement the interpreter.Activation in a way that when the name of the lazy expression is provid…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by TristonianJones
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants