You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm finding it hard to figure out how to use the cel.Constant environment option. As it is an environment option, I assume it is intended for general use and not as an internal feature?
For cel.Variable, examples abound, such as this from the main README:
The same is not true of cel.Constant. A thorough search of the internet, for various combinations such as "cel-go", "common expression language", "Constant", "cel.Constant", and a bunch of others I tried, all find very little to explain this feature.
I tried to guess at it, but ref.Val has me unsure:
import"github.com/google/cel-go/cel"env, err:=cel.NewEnv(
cel.Constant("name", cel.StringType, "how to create a valid ref.Val?"), // this won't compile, as ref.Val isn't a string type
)
What is the safe, intended way in which I should create a ref.Val for a primitive type such as a string or int?
Also, are constants automatically optimized by evaluating them at compile-time?
I've raised this as an issue rather than discussion, since I think it will help other uses if the answer becomes documentation.
The text was updated successfully, but these errors were encountered:
I'm finding it hard to figure out how to use the cel.Constant environment option. As it is an environment option, I assume it is intended for general use and not as an internal feature?
For cel.Variable, examples abound, such as this from the main README:
The same is not true of cel.Constant. A thorough search of the internet, for various combinations such as "cel-go", "common expression language", "Constant", "cel.Constant", and a bunch of others I tried, all find very little to explain this feature.
I tried to guess at it, but ref.Val has me unsure:
What is the safe, intended way in which I should create a ref.Val for a primitive type such as a string or int?
Also, are constants automatically optimized by evaluating them at compile-time?
I've raised this as an issue rather than discussion, since I think it will help other uses if the answer becomes documentation.
The text was updated successfully, but these errors were encountered: