Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackMock ¶
CallbackMock is used for testing Task
func (*CallbackMock) CallNoArgs ¶
func (m *CallbackMock) CallNoArgs()
CallNoArgs is a dummy function which accepts no arguments
func (*CallbackMock) CallWithArgs ¶
func (m *CallbackMock) CallWithArgs(arg1 string, arg2 bool)
CallWithArgs is a dummy function which accepts two arguments
func (*CallbackMock) CallWithChan ¶
func (m *CallbackMock) CallWithChan(channel chan bool)
CallWithChan is a dummy function to test failure with non-hashable parameters
type FuncRegistry ¶
type FuncRegistry struct {
// contains filtered or unexported fields
}
FuncRegistry holds the list of all registered task functions.
func NewFuncRegistry ¶
func NewFuncRegistry() *FuncRegistry
NewFuncRegistry will return an instance of the FuncRegistry.
func (*FuncRegistry) Add ¶
func (reg *FuncRegistry) Add(function Function) (FunctionMeta, error)
Add appends the function to the registry after resolving specific information about this function.
func (*FuncRegistry) Exists ¶
func (reg *FuncRegistry) Exists(name string) bool
Exists checks if a function with provided name exists.
func (*FuncRegistry) Get ¶
func (reg *FuncRegistry) Get(name string) (FunctionMeta, error)
Get returns the FunctionMeta instance which holds all information about any single registered task function.
type FunctionMeta ¶
type FunctionMeta struct { Name string // contains filtered or unexported fields }
FunctionMeta holds information about function such as name and parameters.
func (*FunctionMeta) Params ¶
func (meta *FunctionMeta) Params() []reflect.Type
Params returns the list of parameter types
type Schedule ¶
type Schedule struct { IsRecurring bool LastRun time.Time NextRun time.Time Duration time.Duration }
Schedule holds information about the execution times of a specific task
type Task ¶
type Task struct { Schedule Func FunctionMeta Params []Param }
Task holds information about task
func NewWithSchedule ¶
func NewWithSchedule(function FunctionMeta, params []Param, schedule Schedule) *Task
NewWithSchedule creates an instance of task with the provided schedule information