mytask

package module
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: BSD-3-Clause Imports: 11 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddThenStart

func AddThenStart(task ScheduleTask, spec string, runImmediately bool)

func AddTimerThenStart added in v1.0.8

func AddTimerThenStart(task ScheduleTask, t time.Duration, asyncTask, runImmediately bool)

func GetTaskModel added in v1.0.9

func GetTaskModel(taskId int64) (any, bool)

func IsExist added in v1.0.3

func IsExist(id int64) bool

func Remove added in v1.0.2

func Remove(id int64)

func ResetCron added in v1.0.8

func ResetCron(id int64, spec string) error

func ResetTimer added in v1.0.8

func ResetTimer(id int64, tm time.Duration, asyncTask bool) error

func Stop added in v1.0.2

func Stop(id int64)

Types

type BaseTask added in v1.0.6

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

func (*BaseTask) Cmd added in v1.0.6

func (self *BaseTask) Cmd() func()

func (*BaseTask) ID added in v1.0.6

func (self *BaseTask) ID() int64

func (*BaseTask) SetID added in v1.0.6

func (self *BaseTask) SetID(id int64)

type ScheduleTask

type ScheduleTask interface {
	ID() int64
	Cmd() func()
}

func NewDiskLogCls added in v1.0.11

func NewDiskLogCls(id int, maxLogSizeMB int) ScheduleTask

func NewMysqlDBBackup added in v1.0.11

func NewMysqlDBBackup(id int, dbUser, dbPass, dbName, backupPath, dockerName string, isSudo bool) ScheduleTask

type TimerTask added in v1.0.8

type TimerTask struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTimerTask added in v1.0.8

func NewTimerTask(duration time.Duration, t ScheduleTask) *TimerTask

func (*TimerTask) Cancel added in v1.0.8

func (self *TimerTask) Cancel()

Cancel :取消停任,释放资源

func (*TimerTask) Start added in v1.0.8

func (self *TimerTask) Start(asyncTask bool)

启动定时任务

func (*TimerTask) Stop added in v1.0.8

func (self *TimerTask) Stop()

停止任务,重置定时器

Jump to

Keyboard shortcuts

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