-
Notifications
You must be signed in to change notification settings - Fork 47
/
options.go
42 lines (34 loc) · 879 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package tester
import (
"log/slog"
"time"
"github.com/cschleiden/go-workflows/backend/converter"
"github.com/cschleiden/go-workflows/workflow"
)
type options struct {
TestTimeout time.Duration
Logger *slog.Logger
Converter converter.Converter
Propagators []workflow.ContextPropagator
}
type WorkflowTesterOption func(*options)
func WithLogger(logger *slog.Logger) WorkflowTesterOption {
return func(o *options) {
o.Logger = logger
}
}
func WithConverter(converter converter.Converter) WorkflowTesterOption {
return func(o *options) {
o.Converter = converter
}
}
func WithContextPropagator(prop workflow.ContextPropagator) WorkflowTesterOption {
return func(o *options) {
o.Propagators = append(o.Propagators, prop)
}
}
func WithTestTimeout(timeout time.Duration) WorkflowTesterOption {
return func(o *options) {
o.TestTimeout = timeout
}
}