Skip to content

Conversation

@ccremer
Copy link
Owner

@ccremer ccremer commented Apr 12, 2022

Summary

  • Adds VariableContext, AddToContext, ValueFromContext functions

Usage example:

ctx := VariableContext(context.Background())
p := NewPipeline().WithSteps(
NewStepFromFunc("store value", func(ctx context.Context) error {
AddToContext(ctx, "key", "value")
return nil
}),
NewStepFromFunc("retrieve value", func(ctx context.Context) error {
value, _ := ValueFromContext(ctx, "key")
fmt.Println(value)
return nil
}),
)
p.RunWithContext(ctx)

Checklist

  • Categorize the PR by setting a good title and adding one of the labels:
    fix, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog
  • Update documentation.
  • Update tests.

@ccremer ccremer added the enhancement New feature or request label Apr 12, 2022
@ccremer ccremer merged commit becd0df into master Apr 12, 2022
@ccremer ccremer deleted the context-map branch April 12, 2022 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants