Documentation ¶
Index ¶
- Constants
- type Controller
- type Executor
- type Manager
- type Record
- type Schedule
- type Service
- func (s *Service) AddSchedule(schedule *Schedule) error
- func (s *Service) BatchDeleteSchedule(ids []uuid.UUID) error
- func (s *Service) BatchSetScheduleEnable(ids []uuid.UUID, enabled bool) error
- func (s *Service) DeleteSchedule(id uuid.UUID) error
- func (s *Service) DetailSchedule(id uuid.UUID) (*Schedule, error)
- func (s *Service) GetTaskExecutors() []Executor
- func (s *Service) Initialize() (err error)
- func (s *Service) PageSchedule(num, size int, schedule *Schedule) (*database.Pager[*Schedule], error)
- func (s *Service) PageScheduleRecord(num, size int, record *Record) (*database.Pager[*Record], error)
- func (s *Service) UpdateSchedule(schedule *Schedule) error
- type Task
- type TestTask
- type WrappedTask
Constants ¶
View Source
const ( ActionOwner = "owner" ActionAdmin = "admin" ActionUser = "user" AuthDomain = "schedule" )
View Source
const ( TaskStatusRunning = "running" TaskStatusError = "error" TaskStatusSuccess = "success" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController() *Controller
func (*Controller) RegisterRoute ¶
func (c *Controller) RegisterRoute(group *gin.RouterGroup)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func GetExecutorManager ¶
func GetExecutorManager() *Manager
func (*Manager) GetExecutors ¶
type Record ¶
type Record struct { ID uuid.UUID `json:"id" gorm:"primary_key;type:uuid;" swaggerignore:"true"` ScheduleID uuid.UUID `json:"scheduleID" gorm:"type:uuid;"` Title string `json:"title" validate:"required"` Executor string `json:"executor" validate:"required"` Params string `json:"params"` Status string `json:"status"` database.BaseModel }
type Schedule ¶
type Schedule struct { ID uuid.UUID `json:"id" gorm:"primary_key;type:uuid;" example:"00000000-0000-0000-0000-000000000000"` Title string `json:"title" validate:"required"` Desc string `json:"desc"` CronString string `json:"cronString" validate:"required" example:"*/5 * * * * *"` Executor string `json:"executor" validate:"required" example:"test"` NextTime time.Time `json:"nextTime" gorm:"-" swaggerignore:"true"` Params string `json:"params"` Enabled bool `json:"enabled" example:"true"` Status string `json:"status"` database.BaseModel }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func GetService ¶
func GetService() *Service
func (*Service) AddSchedule ¶
AddSchedule add schedule
func (*Service) BatchDeleteSchedule ¶
BatchDeleteSchedule batch delete schedule
func (*Service) BatchSetScheduleEnable ¶
BatchSetScheduleEnable batch set schedule enable
func (*Service) DeleteSchedule ¶
DeleteSchedule delete schedule
func (*Service) DetailSchedule ¶
DetailSchedule detail schedule
func (*Service) GetTaskExecutors ¶
GetTaskExecutors get task executors
func (*Service) Initialize ¶
func (*Service) PageSchedule ¶
func (s *Service) PageSchedule(num, size int, schedule *Schedule) (*database.Pager[*Schedule], error)
PageSchedule page schedules
func (*Service) PageScheduleRecord ¶
func (s *Service) PageScheduleRecord(num, size int, record *Record) (*database.Pager[*Record], error)
PageScheduleRecord page task records
func (*Service) UpdateSchedule ¶
UpdateSchedule update schedule
type Task ¶
type Task interface { // Run task entry Run() // SetParams set task params, you can use it to set task configuration SetParams(params string) }
type WrappedTask ¶
type WrappedTask struct { Task // contains filtered or unexported fields }
func NewWrapper ¶
func NewWrapper(task Task, schedule *Schedule) *WrappedTask
func (*WrappedTask) Run ¶
func (w *WrappedTask) Run()
Click to show internal directories.
Click to hide internal directories.