Documentation
¶
Overview ¶
Package cron is a generated GoMock package.
Package cron is a generated GoMock package.
Index ¶
- type Cron
- type Event
- type Execution
- type LoadEvents
- type MockCron
- type MockCronMockRecorder
- type MockEvent
- type MockEventMockRecorder
- func (mr *MockEventMockRecorder) GetDayOfMonth() *gomock.Call
- func (mr *MockEventMockRecorder) GetDayOfWeek() *gomock.Call
- func (mr *MockEventMockRecorder) GetHour() *gomock.Call
- func (mr *MockEventMockRecorder) GetID() *gomock.Call
- func (mr *MockEventMockRecorder) GetMinute() *gomock.Call
- func (mr *MockEventMockRecorder) GetMonth() *gomock.Call
- type Result
- type Schedule
- type Scheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cron ¶
type Cron interface {
// Start the cron scheduler
Start() (<-chan *Execution, error)
// Stop the cron scheduler
Stop()
// Schedule an event to be executed on its schedule. This should
// be called when adding events outside of Reload operations.
// This method is idempotent and can be used to update existing schedules
// of events as well as add new events.
Schedule(event Event)
// Unschedule an event from the scheduler.
Unschedule(event string)
}
Cron is an interface for scheduling recurring events to be triggered. When Start is called, a channel will be returned that will be populated with Execution objects for each event that is triggered according to its schedule.
type Event ¶
type Event interface {
Schedule
// GetID is a unique identifier for this event that can be
// used to update or remove it from the scheduler.
GetID() string
}
Event that can be scheduled for execution at a specific time.
type Execution ¶
type Execution struct {
// Event id that was executed
Event Event
// Time the event was executed
Time int64
}
Execution represents an event execution and the result
type LoadEvents ¶
type LoadEvents func(qb.LimitOffset) ([]Event, int, error)
LoadEvents for scheduling in an instance of Cron
type MockCron ¶
type MockCron struct {
// contains filtered or unexported fields
}
MockCron is a mock of Cron interface.
func NewMockCron ¶
func NewMockCron(ctrl *gomock.Controller) *MockCron
NewMockCron creates a new mock instance.
func (*MockCron) EXPECT ¶
func (m *MockCron) EXPECT() *MockCronMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockCron) Unschedule ¶
Unschedule mocks base method.
type MockCronMockRecorder ¶
type MockCronMockRecorder struct {
// contains filtered or unexported fields
}
MockCronMockRecorder is the mock recorder for MockCron.
func (*MockCronMockRecorder) Schedule ¶
func (mr *MockCronMockRecorder) Schedule(event any) *gomock.Call
Schedule indicates an expected call of Schedule.
func (*MockCronMockRecorder) Start ¶
func (mr *MockCronMockRecorder) Start() *gomock.Call
Start indicates an expected call of Start.
func (*MockCronMockRecorder) Stop ¶
func (mr *MockCronMockRecorder) Stop() *gomock.Call
Stop indicates an expected call of Stop.
func (*MockCronMockRecorder) Unschedule ¶
func (mr *MockCronMockRecorder) Unschedule(event any) *gomock.Call
Unschedule indicates an expected call of Unschedule.
type MockEvent ¶
type MockEvent struct {
// contains filtered or unexported fields
}
MockEvent is a mock of Event interface.
func NewMockEvent ¶
func NewMockEvent(ctrl *gomock.Controller) *MockEvent
NewMockEvent creates a new mock instance.
func (*MockEvent) EXPECT ¶
func (m *MockEvent) EXPECT() *MockEventMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockEvent) GetDayOfMonth ¶
GetDayOfMonth mocks base method.
func (*MockEvent) GetDayOfWeek ¶
GetDayOfWeek mocks base method.
type MockEventMockRecorder ¶
type MockEventMockRecorder struct {
// contains filtered or unexported fields
}
MockEventMockRecorder is the mock recorder for MockEvent.
func (*MockEventMockRecorder) GetDayOfMonth ¶
func (mr *MockEventMockRecorder) GetDayOfMonth() *gomock.Call
GetDayOfMonth indicates an expected call of GetDayOfMonth.
func (*MockEventMockRecorder) GetDayOfWeek ¶
func (mr *MockEventMockRecorder) GetDayOfWeek() *gomock.Call
GetDayOfWeek indicates an expected call of GetDayOfWeek.
func (*MockEventMockRecorder) GetHour ¶
func (mr *MockEventMockRecorder) GetHour() *gomock.Call
GetHour indicates an expected call of GetHour.
func (*MockEventMockRecorder) GetID ¶
func (mr *MockEventMockRecorder) GetID() *gomock.Call
GetID indicates an expected call of GetID.
func (*MockEventMockRecorder) GetMinute ¶
func (mr *MockEventMockRecorder) GetMinute() *gomock.Call
GetMinute indicates an expected call of GetMinute.
func (*MockEventMockRecorder) GetMonth ¶
func (mr *MockEventMockRecorder) GetMonth() *gomock.Call
GetMonth indicates an expected call of GetMonth.
type Schedule ¶
type Schedule interface {
// GetMinute of execution, [0,59]
GetMinute() int32
// GetDayOfWeek of execution [1,7]
GetDayOfWeek() int32
// GetDayOfMonth of execution [1,31]
GetDayOfMonth() int32
// GetMonth of execution, [1,12]
GetMonth() int32
// GetHour of execution [0,23]
GetHour() int32
}
Schedule for an Event to be executed on. Negative values indicate that the field is not applicable.