Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrHandler ¶
func ErrHandler(job *JobStruct)
func RegisterTask ¶
func RegisterTask(name string, f func(...string) string, cronExpression, concurrent, misfirePolicy string, logFunc func(name, info, state, cost string))
RegisterTask register a task,then run this task with giving cronExpression,concurrent and misfirePolicy. name is the register task name,f is what the task really run,cronExpression is cronExpression like linux crontab, concurrent 0 means the task is concurrent,1 means the task is non-concurrent misfirePolicy 0 means can run interval,1 run only once with cronExpression,2 run immediately only once with non-cronExpression logFunc is a func which will be call no matter task is run successful or failed. the params info is the returning result of f,state 0 means successful,1 means failed
Types ¶
type JobStruct ¶
type JobStruct struct { Id cron.EntryID Name string MisfirePolicy string //0重复执行1执行一次2立即执行一次 Concurrent string //0并发执行1不并发执行 CronExpression string F func(...string) string InvokeTarget string Params []reflect.Value Param []string LogFunc func(name, info, state, cost string) //state 0成功1失败 JobCron *cron.Cron IsAdd bool // contains filtered or unexported fields }
func (*JobStruct) UpdateParams ¶
func (job *JobStruct) UpdateParams()
Click to show internal directories.
Click to hide internal directories.