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

Fix setUpdateHandler docstring #1625

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions internal/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1987,17 +1987,17 @@ func (wc *workflowEnvironmentInterceptor) SetQueryHandlerWithOptions(
return setQueryHandler(ctx, queryType, handler, options)
}

// 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
// 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
// workflow code, namely, the update handler must be deterministic. As with
// other workflow code, update code is free to invoke and wait on the results of
// activities. Update handler code is free to mutate workflow state.
// 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 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 workflow code, namely, the
// update handler must be deterministic. As with other workflow code, update
// code is free to invoke and wait on the results of activities. Update handler
// code is free to mutate workflow state.
//
// This registration can optionally specify (through UpdateHandlerOptions) an
// update validation function. If provided, this function will be invoked before
Expand Down
22 changes: 11 additions & 11 deletions workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ func SetQueryHandlerWithOptions(ctx Context, queryType string, handler interface
return internal.SetQueryHandlerWithOptions(ctx, queryType, handler, options)
}

// SetUpdateHandler forwards to SetUpdateHandlerWithOptions with an
// SetUpdateHandler forwards to SetUpdateHandlerWithOptions with a
// zero-initialized UpdateHandlerOptions struct. See SetUpdateHandlerWithOptions
// for more details.
//
Expand All @@ -534,14 +534,14 @@ 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
// 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
// workflow code, namely, the update handler must be deterministic. As with
// other workflow code, update code is free to invoke and wait on the results of
// activities. Update handler code is free to mutate workflow state.
// 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 workflow code,
// namely, the update handler must be deterministic. As with other workflow
// code, update code is free to invoke and wait on the results of activities.
// Update handler code is free to mutate workflow state.
//
// This registration can optionally specify (through UpdateHandlerOptions) an
// update validation function. If provided, this function will be invoked before
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
Loading