go_task

package module
v0.0.0-...-9567ea2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 4 Imported by: 0

README

go-task

task manager

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

func NewContext

func NewContext() *Context

func (*Context) GetInt

func (ctx *Context) GetInt(key any) (int, bool)

func (*Context) GetString

func (ctx *Context) GetString(key any) (string, bool)

func (*Context) GetValue

func (ctx *Context) GetValue(key any) (any, bool)

func (*Context) IsCanceled

func (ctx *Context) IsCanceled() bool

func (*Context) SetValue

func (ctx *Context) SetValue(key, val any)

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) Add

func (m *Manager) Add(task *Task) error

func (*Manager) Delete

func (m *Manager) Delete(key string) error

type Task

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

Task 任务

func NewTask

func NewTask(key string, fn func(*Context), interval int) *Task

func NewTaskWithContext

func NewTaskWithContext(key string, fn func(*Context), interval int, ctx *Context) *Task

func (*Task) Can

func (t *Task) Can() bool

Can 任务是否达到了启动的条件

func (*Task) NextTick

func (t *Task) NextTick() int64

func (*Task) Run

func (t *Task) Run()

Jump to

Keyboard shortcuts

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