Skip to content
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

Pass context.Context to cue build, evaluation and builtins #2590

Closed
bozaro opened this issue Sep 11, 2023 · 1 comment
Closed

Pass context.Context to cue build, evaluation and builtins #2590

bozaro opened this issue Sep 11, 2023 · 1 comment
Labels
FeatureRequest New feature or request Triage Requires triage/attention

Comments

@bozaro
Copy link
Contributor

bozaro commented Sep 11, 2023

Is your feature request related to a problem? Please describe.
I want have ability to solve two problems:

  • allow interrupt cue evaluation (unfortunately it can take minutes);
  • pass some data to builtins functions (in my case I try create request cache for gRPC client calls).

Describe the solution you'd like
I wan't to set context.Context to every cue evaluation operation.

Something like this: master...joomcode:cue:context-poc

func EvalWithContext(ctx context.Context, value cue.Value, args ast.Expr) cue.Value {
        return value.
                WithContext(ctx).
                FillPath(cue.MakePath(cue.Str("args")), args).
                LookupPath(cue.MakePath(cue.Str("result"))).
                Eval()
}
@bozaro bozaro added FeatureRequest New feature or request Triage Requires triage/attention labels Sep 11, 2023
@mvdan
Copy link
Member

mvdan commented Sep 12, 2023

Indeed this is something we should add. See #1104; I'm going to close this for now, to prevent the discussion from being split :)

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest New feature or request Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

2 participants