Skip to content

Commit

Permalink
Fix update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Sep 7, 2024
1 parent cd4c54c commit cf9a0ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1990,8 +1990,8 @@ func (wc *workflowEnvironmentInterceptor) SetQueryHandlerWithOptions(
// SetUpdateHandler binds an update handler function to the specified
// name such that update invocations specifying that name will invoke the
// handler. The handler function can take as input any number of parameters so
// long as they can be serialized/deserialized by the system. The handler can
// take a workflow.Context as its first parameter but this is not required. The
// long as they can be serialized/deserialized by the system. The handler must
// take a workflow.Context as its first parameter. The
// update handler must return either a single error or a single serializable
// object along with a single error. The update handler function is invoked in
// the context of the workflow and thus is subject to the same restrictions as
Expand Down
8 changes: 4 additions & 4 deletions workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ func SetUpdateHandler(ctx Context, updateName string, handler interface{}) error
// SetUpdateHandlerWithOptions binds an update handler function to the specified
// name such that update invocations specifying that name will invoke the
// handler. The handler function can take as input any number of parameters so
// long as they can be serialized/deserialized by the system. The handler can
// take a [workflow.Context] as its first parameter but this is not required. The
// long as they can be serialized/deserialized by the system. The handler must
// take a [workflow.Context] as its first parameter. The
// update handler must return either a single error or a single serializable
// object along with a single error. The update handler function is invoked in
// the context of the workflow and thus is subject to the same restrictions as
Expand All @@ -561,11 +561,11 @@ func SetUpdateHandler(ctx Context, updateName string, handler interface{}) error
// err := workflow.SetUpdateHandlerWithOptions(
// ctx,
// "add",
// func(val int) (int, error) { // Calls
// func(ctx workflow.Context, val int) (int, error) {
// counter += val // note that this mutates workflow state
// return counter, nil
// },
// UpdateHandlerOptions{
// workflow.UpdateHandlerOptions{
// Validator: func(val int) error {
// if val < 0 { // reject attempts to add negative values
// return fmt.Errorf("invalid addend: %v", val)
Expand Down

0 comments on commit cf9a0ee

Please sign in to comment.