Documentation ¶
Index ¶
- Variables
- type Executor
- func (e Executor[Arg, Res]) Execute(argMethod, fnMethod Method, args []Arg, fn ...func(Arg) (Res, error)) (res Res, err error)
- func (e Executor[Arg, Res]) ExecuteConcurrentArg(arg []Arg, fn ...func(Arg) (Res, error)) (Res, error)
- func (e Executor[Arg, Res]) ExecuteConcurrentFunc(arg []Arg, fn ...func(Arg) (Res, error)) (Res, error)
- func (e Executor[Arg, Res]) ExecuteRandom(arg []Arg, fn ...func(Arg) (Res, error)) (Res, error)
- func (e Executor[Arg, Res]) ExecuteSerial(arg []Arg, fn ...func(Arg) (Res, error)) (Res, error)
- type Method
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSkip = errors.New("skip") ErrAllSkipped = errors.New("all skipped") )
Functions ¶
This section is empty.
Types ¶
type Executor ¶
Executor is a generic type for managing job execution.
func (Executor[Arg, Res]) Execute ¶
func (e Executor[Arg, Res]) Execute(argMethod, fnMethod Method, args []Arg, fn ...func(Arg) (Res, error)) (res Res, err error)
Execute gets the result from the functions with several args by specified method. If both argMethod and fnMethod is Concurrent, fnMethod will be first.
func (Executor[Arg, Res]) ExecuteConcurrentArg ¶
func (e Executor[Arg, Res]) ExecuteConcurrentArg(arg []Arg, fn ...func(Arg) (Res, error)) (Res, error)
ExecuteConcurrentArg gets the fastest result from the functions with args, args will be run concurrently.
func (Executor[Arg, Res]) ExecuteConcurrentFunc ¶
func (e Executor[Arg, Res]) ExecuteConcurrentFunc(arg []Arg, fn ...func(Arg) (Res, error)) (Res, error)
ExecuteConcurrentFunc gets the fastest result from the functions with args, functions will be run concurrently.
func (Executor[Arg, Res]) ExecuteRandom ¶
ExecuteRandom gets the result until success from the functions with args randomly.
func (Executor[Arg, Res]) ExecuteSerial ¶
ExecuteSerial gets the result until success from the functions with args in order.
Click to show internal directories.
Click to hide internal directories.