task

package
v0.5.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package task implements tasks struct and its utility methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(ctx context.Context, tasks *Tasks) error

Do runs tasks sequentially and writes log messages to show running status. If i-th task failed, the method will return error directly(tasks after i will not be executed).

Types

type Tasks

type Tasks struct {
	// contains filtered or unexported fields
}

Tasks describes a composite task which contains a slice of tasks.

func NewTasks

func NewTasks(ctx context.Context, name string) *Tasks

NewTasks returns a new tasks.

func (*Tasks) AddTask

func (t *Tasks) AddTask(name string, callFun func(context.Context) error)

AddTask appends a new task to the end of the task slice.

func (*Tasks) GetTaskNames

func (t *Tasks) GetTaskNames() []string

GetTaskNames returns all sub task names owned by tasks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL