Documentation
¶
Index ¶
- Variables
- func Run()
- type FuncToExec
- type LogDTFormat
- type TaskScheduler
- type Tasks
- func (s *Tasks) AddTask()
- func (s *Tasks) At(rt string) *Tasks
- func (s *Tasks) Daily() *Tasks
- func (s *Tasks) Every(day int) *Tasks
- func (s *Tasks) ExecFunc(fn FuncToExec) *Tasks
- func (s *Tasks) Frequently() *Tasks
- func (s *Tasks) Friday() *Tasks
- func (s *Tasks) Hours(interval int) *Tasks
- func (s *Tasks) Minutes(interval int) *Tasks
- func (s *Tasks) Monday() *Tasks
- func (s *Tasks) Monthly() *Tasks
- func (s *Tasks) OneTime(dt int64) *Tasks
- func (s *Tasks) Saturday() *Tasks
- func (s *Tasks) Seconds(interval int) *Tasks
- func (s *Tasks) Sunday() *Tasks
- func (s *Tasks) Thursday() *Tasks
- func (s *Tasks) Tuesday() *Tasks
- func (s *Tasks) Wednesday() *Tasks
- func (s *Tasks) Weekly() *Tasks
Constants ¶
This section is empty.
Variables ¶
var ChannelTS = make(chan bool, 1)
ChannelTS is the channel to be used during cancellation of all the tasks that are currently running, this is useful when reloading some config variables to get the latest values and reload the task scheduler.
var DTFormat string = _dateTimeFormat
DTFormat is the standard DateTime format to be used for logging information
var TK = Tasks{}
TK initialize the 'Tasks' struct with an empty values
var TS = TaskScheduler{TaskList: make(map[string][]Tasks)}
TS initialize the 'TaskScheduler' struct with an empty values
Functions ¶
Types ¶
type FuncToExec ¶
type FuncToExec func()
FuncToExec is the function that needs to be executed as parameter
type LogDTFormat ¶
type LogDTFormat struct { DTFormat string // contains filtered or unexported fields }
LogDTFormat is the DateTime format for each logs
func SetLogDT ¶
func SetLogDT(dtFormat string) *LogDTFormat
SetLogDT customizes the DateTime logging format to be used for each logs
type TaskScheduler ¶
TaskScheduler is the task scheduler's format
func (*TaskScheduler) Get ¶
func (t *TaskScheduler) Get(taskName string) ([]Tasks, bool)
Get gets the specific task information using the task name
func (*TaskScheduler) UpdateNextRunTime ¶
func (t *TaskScheduler) UpdateNextRunTime(s *Tasks)
UpdateNextRunTime modify the next run time
type Tasks ¶
type Tasks struct { Name string RunType string // options: onetime, frequently, daily, weekly, monthly FrequencyInterval string // use for frequently option only: seconds, minutes, hours FrequencyValue int // use for frequently option only, minimum value of 1, e.g 1 second ExecuteFunc FuncToExec // user's defined func to be executed // contains filtered or unexported fields }
Tasks is the individual task item to be executed
func TaskName ¶ added in v1.0.2
TaskName method is the run type option of each task that execute once only
func (*Tasks) Every ¶
Every is use mainly for the 'Monthly' method that serve as the specific day of each month
func (*Tasks) ExecFunc ¶
func (s *Tasks) ExecFunc(fn FuncToExec) *Tasks
ExecFunc method collect the function as parameter that needs to be executed
func (*Tasks) Frequently ¶
Frequently method is the run type option of each task that execute frequently Options: seconds, minutes, hours
func (*Tasks) Minutes ¶
Minutes is the naming convention for the Frequently method as 'minutes' option
func (*Tasks) Seconds ¶
Seconds is the naming convention for the Frequently method as 'seconds' option