Documentation ¶
Index ¶
- Variables
- type TaskFunc
- type TaskItem
- type TaskManager
- func (tm *TaskManager) AddTask(task *TaskItem)
- func (tm *TaskManager) Cancel(name string) error
- func (tm *TaskManager) CancelAll()
- func (tm *TaskManager) Get(name string) *TaskItem
- func (tm *TaskManager) Has(name string) bool
- func (tm *TaskManager) Names() []string
- func (tm *TaskManager) Register(name string, tf TaskFunc) *TaskItem
- func (tm *TaskManager) RmTask(name string) error
- func (tm *TaskManager) Run(ctx context.Context, name string) error
- func (tm *TaskManager) Watch(ctx context.Context, name string, dependencies ...string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTaskNotFound = errors.New("task not found")
ErrTaskNotFound is returned when a task is not found
Functions ¶
This section is empty.
Types ¶
type TaskItem ¶
TaskItem is the task item stored in the TaskManager
func NewTaskItem ¶
NewTaskItem creates a new task item
type TaskManager ¶
TaskManager allows you to create tasks and run them
func (*TaskManager) AddTask ¶
func (tm *TaskManager) AddTask(task *TaskItem)
AddTask adds a task to the task manager
func (*TaskManager) Has ¶
func (tm *TaskManager) Has(name string) bool
Has returns true if the task exists
func (*TaskManager) Names ¶
func (tm *TaskManager) Names() []string
Names returns the names of all the tasks
func (*TaskManager) Register ¶
func (tm *TaskManager) Register(name string, tf TaskFunc) *TaskItem
Register creates a new task
func (*TaskManager) RmTask ¶
func (tm *TaskManager) RmTask(name string) error
RmTask removes a task from the task manager
Click to show internal directories.
Click to hide internal directories.