flow: implement new methods, add Async ExecutionOption

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-07-16 00:17:16 +03:00
parent 10a09a5c6f
commit 09e6fa2fed
3 changed files with 96 additions and 24 deletions

View File

@@ -124,6 +124,8 @@ type ExecuteOptions struct {
Reverse bool
// Timeout for execution
Timeout time.Duration
// Async enables async execution
Async bool
}
type ExecuteOption func(*ExecuteOptions)
@@ -170,6 +172,12 @@ func ExecuteTimeout(td time.Duration) ExecuteOption {
}
}
func ExecuteAsync(b bool) ExecuteOption {
return func(o *ExecuteOptions) {
o.Async = b
}
}
func NewExecuteOptions(opts ...ExecuteOption) ExecuteOptions {
options := ExecuteOptions{
Client: client.DefaultClient,