@@ -4,12 +4,13 @@ import (
4
4
"github.com/cschleiden/go-workflows/internal/sync"
5
5
)
6
6
7
- type Context = sync.Context
7
+ type (
8
+ Context = sync.Context
9
+ WaitGroup = sync.WaitGroup
10
+ )
8
11
9
12
var Canceled = sync .Canceled
10
13
11
- type WaitGroup = sync.WaitGroup
12
-
13
14
func NewWaitGroup () WaitGroup {
14
15
return sync .NewWaitGroup ()
15
16
}
@@ -18,33 +19,3 @@ func NewWaitGroup() WaitGroup {
18
19
func Go (ctx Context , f func (ctx Context )) {
19
20
sync .Go (ctx , f )
20
21
}
21
-
22
- type SelectCase = sync.SelectCase
23
-
24
- // Select is the workflow-save equivalent of the select statement.
25
- func Select (ctx Context , cases ... SelectCase ) {
26
- sync .Select (ctx , cases ... )
27
- }
28
-
29
- // Await calls the provided handler when the given future is ready.
30
- func Await [T any ](f Future [T ], handler func (Context , Future [T ])) SelectCase {
31
- return sync .Await [T ](f , func (ctx sync.Context , f sync.Future [T ]) {
32
- handler (ctx , f )
33
- })
34
- }
35
-
36
- // Receive calls the provided handler if the given channel can receive a value. The handler receives
37
- // the received value, and the ok flag indicating whether the value was received or the channel was closed.
38
- func Receive [T any ](c Channel [T ], handler func (ctx Context , v T , ok bool )) SelectCase {
39
- return sync .Receive [T ](c , handler )
40
- }
41
-
42
- // Send calls the provided handler if the given value can be sent to the channel.
43
- func Send [T any ](c Channel [T ], value * T , handler func (ctx Context )) SelectCase {
44
- return sync .Send [T ](c , value , handler )
45
- }
46
-
47
- // Default calls the given handler if none of the other cases match.
48
- func Default (handler func (Context )) SelectCase {
49
- return sync .Default (handler )
50
- }
0 commit comments