Embedding in golang #992
-
Planning to use cue for a document validation/transformation service. We will have a golang service that accept cue scripts, execute and return the resultant JSON. The snippet below works as long as there are no library imports. func evalCue(input string) (string, error) { For the input below, looks like compilation removes the imports and results in error : "| // str: cannot call non-function strings.ToUpper (type |) " body := Any examples on how to handle this? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
To use builtins you just need to import them in your go code like that:
For managing imports of custom modules you will need to use |
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#992. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
To use builtins you just need to import them in your go code like that:
For managing imports of custom modules you will need to use
load.Instances
instead ofRuntime.Compile
.