@@ -53,39 +53,32 @@ func Register2(name string, handler WfFunc2, custom ...func(wf *Workflow)) error
53
53
return defaultFac .register (name , handler , custom ... )
54
54
}
55
55
56
- // Execute is the same as ExecuteCtx, but with context.Background
57
- func Execute (name string , gid string , data []byte ) error {
58
- return ExecuteCtx (context .Background (), name , gid , data )
59
- }
60
-
61
56
// ExecuteCtx will execute a workflow with the gid and specified params
62
57
// if the workflow with the gid does not exist, then create a new workflow and execute it
63
58
// if the workflow with the gid exists, resume to execute it
64
- func ExecuteCtx (ctx context.Context , name string , gid string , data []byte ) error {
65
- _ , err := defaultFac .execute (ctx , name , gid , data )
59
+ func ExecuteCtx (ctx context.Context , name string , gid string , data []byte ) ([]byte , error ) {
60
+ return defaultFac .execute (ctx , name , gid , data )
61
+ }
62
+
63
+ // Execute is the same as ExecuteCtx, but with context.Background
64
+ // Deprecated: use ExecuteCtx instaead
65
+ func Execute (name string , gid string , data []byte ) error {
66
+ _ , err := ExecuteCtx (context .Background (), name , gid , data )
66
67
return err
67
68
}
68
69
69
70
// Execute2 is the same as Execute, but workflow func can return result
71
+ // Deprecated: use ExecuteCtx instaead
70
72
func Execute2 (name string , gid string , data []byte ) ([]byte , error ) {
71
- return Execute2Ctx (context .Background (), name , gid , data )
72
- }
73
-
74
- // Execute2Ctx is the same as Execute2, but with context.Background
75
- func Execute2Ctx (ctx context.Context , name string , gid string , data []byte ) ([]byte , error ) {
76
- return defaultFac .execute (ctx , name , gid , data )
73
+ return ExecuteCtx (context .Background (), name , gid , data )
77
74
}
78
75
79
76
// ExecuteByQS is like Execute, but name and gid will be obtained from qs
77
+ // Deprecated: use ExecuteCtx instaead
80
78
func ExecuteByQS (qs url.Values , body []byte ) error {
81
- return ExecuteByQSCtx (context .Background (), qs , body )
82
- }
83
-
84
- // ExecuteByQSCtx is the same as ExecuteByQS, but with context.Background
85
- func ExecuteByQSCtx (ctx context.Context , qs url.Values , body []byte ) error {
86
79
name := qs .Get ("op" )
87
80
gid := qs .Get ("gid" )
88
- _ , err := defaultFac . execute ( ctx , name , gid , body )
81
+ _ , err := ExecuteCtx ( context . Background () , name , gid , body )
89
82
return err
90
83
}
91
84
0 commit comments