Documentation ¶
Index ¶
Constants ¶
const ( // TaskReturnEmptyResult indicates an empty function return TaskReturnEmptyResult = iota // TaskReturnErrorOnly indicates an function that returns an error only TaskReturnErrorOnly // TaskReturnResultOnly indicates a function that return a interface{} result only TaskReturnResultOnly // TaskReturnResultAndError indicates a function that return both an interface{} and error result TaskReturnResultAndError )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task structure contains task function reflection information, position in results, and the return type
type TaskFunc ¶
type TaskFunc struct { Func interface{} Name string }
TaskFunc is a function that returns nothing (empty), an error, or a result and error
type TaskResult ¶
type TaskResult struct { Name string Done bool Error error Result interface{} // contains filtered or unexported fields }
TaskResult has the task Error or Result
func Parallel ¶
func Parallel(ctx context.Context, tfs ...*TaskFunc) ([]TaskResult, error)
Parallel calls the set of tasks in parallel using the given context
func SequentialWithTimeout ¶
func SequentialWithTimeout(ctx context.Context, timeout time.Duration, tfs ...*TaskFunc) ([]TaskResult, error)
SequentialWithTimeout calls the set of tasks in sequential order using the given context with timeout
type TaskResults ¶
type TaskResults []TaskResult
TaskResults is as an array of TaskResult
func ParallelWithTimeout ¶
func ParallelWithTimeout(ctx context.Context, timeout time.Duration, tfs ...*TaskFunc) (TaskResults, error)
ParallelWithTimeout calls the set of tasks in parallel using the given context with timeout
func Sequential ¶
func Sequential(ctx context.Context, tfs ...*TaskFunc) (TaskResults, error)
Sequential calls the set of tasks in sequential order using the given context
func (TaskResults) Error ¶
func (trs TaskResults) Error() string
Error return a string representation of the TaskResults Errors
func (TaskResults) HasError ¶
func (trs TaskResults) HasError() bool
HasError determines if any of the TaskResults is an error