Skip to content

Provide "workflow local" #1760

Open
Open
@cretz

Description

@cretz

Describe the solution you'd like

Users need a workflow-local var that is scoped only to the current workflow when accessed via code.

Rough sketch:

  • A user can have var myValue workflow.LocalVar[string]
  • myValue.Get(ctx) returns the workflow-specific value (zero value if never set, no need for a TryGet, a user can choose to wrap in nil-able type for optional/unset if needed)
  • myValue.Set(ctx, value) sets the workflow-specific value

This is basically just type-safe sugar for top-level context value. See temporalio/features#571.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions