Documentation ¶
Index ¶
- func AddTask(t TaskConfig) error
- func Init(db *gorm.DB, serviceName string, taskList []TaskConfig)
- func InitAndRun(db *gorm.DB, serviceName string, taskList []TaskConfig)
- func RemoveTask(t TaskConfig)
- func UpdateTask(db *gorm.DB, t TaskConfig) error
- type Task
- type TaskConfig
- type TaskEvent
- type TaskEventType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTask ¶
func AddTask(t TaskConfig) error
func InitAndRun ¶
func InitAndRun(db *gorm.DB, serviceName string, taskList []TaskConfig)
func RemoveTask ¶
func RemoveTask(t TaskConfig)
func UpdateTask ¶
func UpdateTask(db *gorm.DB, t TaskConfig) error
Types ¶
type TaskConfig ¶
type TaskConfig struct { Code string `gorm:"primarykey;" json:"code"` //英文编码 Cmd int `gorm:"type:int;" json:"cmd"` //数字编码 Name string `gorm:"type:varchar(100)" json:"name"` Value string `gorm:"type:varchar(100)" json:"value"` //执行周期 Remark string `gorm:"type:varchar(200)" json:"remark"` //备注 State int `gorm:"type:tinyint(4);default:1" json:"state"` //0-禁用、1-启用 Param string `gorm:"type:text" json:"param"` //参数,Json Do func() (cron.EntryID, error) `gorm:"-" json:"-"` //执行逻辑 }
func FindTaskConfigByCode ¶
func FindTaskConfigByCode(db *gorm.DB, code string) TaskConfig
type TaskEventType ¶
type TaskEventType int
const ( EnableType TaskEventType //启用 DisableType //禁用 RunOnceType //执行一次 UpdateType //修改任务 )
Click to show internal directories.
Click to hide internal directories.