Skip to content

Commit 1501ada

Browse files
committed
Rename RegisterWithName to WithName
1 parent ebdf0fb commit 1501ada

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

workflow/worker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ type registerOptions struct {
112112

113113
type registerOption func(*registerOptions) error
114114

115-
// RegisterWithName allows you to specify a custom name for the workflow or activity being registered.
115+
// WithName allows you to specify a custom name for the workflow or activity being registered.
116116
// Activities and Workflows registered without an explicit name will use the function name as the name.
117-
func RegisterWithName(name string) registerOption {
117+
func WithName(name string) registerOption {
118118
return func(opts *registerOptions) error {
119119
opts.Name = name
120120
return nil

workflow/worker_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestWorkflowRuntime(t *testing.T) {
4545
require.NoError(t, err)
4646

4747
t.Run("with explicit name", func(t *testing.T) {
48-
err := testWorker.RegisterWorkflow(testWorkflow, RegisterWithName("MyWorkflow"))
48+
err := testWorker.RegisterWorkflow(testWorkflow, WithName("MyWorkflow"))
4949
require.NoError(t, err)
5050
})
5151
})
@@ -58,7 +58,7 @@ func TestWorkflowRuntime(t *testing.T) {
5858
t.Run("with explicit name", func(t *testing.T) {
5959
err := testWorker.RegisterWorkflow(func(ctx *WorkflowContext) (any, error) {
6060
return nil, nil
61-
}, RegisterWithName("MyWorkflow2"))
61+
}, WithName("MyWorkflow2"))
6262
require.NoError(t, err)
6363
})
6464
})
@@ -67,7 +67,7 @@ func TestWorkflowRuntime(t *testing.T) {
6767
require.NoError(t, err)
6868

6969
t.Run("with explicit name", func(t *testing.T) {
70-
err := testWorker.RegisterActivity(testActivity, RegisterWithName("MyActivity"))
70+
err := testWorker.RegisterActivity(testActivity, WithName("MyActivity"))
7171
require.NoError(t, err)
7272
})
7373
})
@@ -80,7 +80,7 @@ func TestWorkflowRuntime(t *testing.T) {
8080
t.Run("with explicit name", func(t *testing.T) {
8181
err := testWorker.RegisterActivity(func(ctx ActivityContext) (any, error) {
8282
return nil, nil
83-
}, RegisterWithName("MyActivity2"))
83+
}, WithName("MyActivity2"))
8484
require.NoError(t, err)
8585
})
8686
})
@@ -96,7 +96,7 @@ func TestWorkerOptions(t *testing.T) {
9696
func TestRegisterOptions(t *testing.T) {
9797
t.Run("with name", func(t *testing.T) {
9898
defaultOpts := registerOptions{}
99-
options, err := processRegisterOptions(defaultOpts, RegisterWithName("testWorkflow"))
99+
options, err := processRegisterOptions(defaultOpts, WithName("testWorkflow"))
100100
require.NoError(t, err)
101101
assert.NotEmpty(t, options.Name)
102102
assert.Equal(t, "testWorkflow", options.Name)

0 commit comments

Comments
 (0)