Documentation ¶
Index ¶
- Constants
- Variables
- type ActionJobBuilder
- func (action *ActionJobBuilder) ContextHandler(handler func(*web.EventContext) map[string]interface{}) *ActionJobBuilder
- func (action *ActionJobBuilder) Description(description string) *ActionJobBuilder
- func (action *ActionJobBuilder) DisplayLog(b bool) *ActionJobBuilder
- func (action ActionJobBuilder) GetParamsModelBuilder() *presets.ModelBuilder
- func (action *ActionJobBuilder) Global(b bool) *ActionJobBuilder
- func (action *ActionJobBuilder) Params(params interface{}) *ActionJobBuilder
- func (action *ActionJobBuilder) ProgressingInterval(interval int) *ActionJobBuilder
- func (action ActionJobBuilder) URL() string
- type Builder
- func (b *Builder) ActionJob(jobName string, model *presets.ModelBuilder, hander JobHandler) *ActionJobBuilder
- func (b *Builder) Activity(ab *activity.ActivityBuilder) *Builder
- func (b *Builder) Configure(pb *presets.Builder) *presets.ModelBuilder
- func (b *Builder) GetCurrentUserIDFunc(f func(r *http.Request) string) *Builder
- func (b *Builder) Listen()
- func (b *Builder) NewJob(name string) *JobBuilder
- func (b *Builder) Queue(q Queue) *Builder
- type GoQueError
- type JobBuilder
- type JobHandler
- type JobInfo
- type Messages
- type QorJob
- type QorJobDefinition
- type QorJobInstance
- func (job *QorJobInstance) AddLog(log string) error
- func (job *QorJobInstance) AddLogf(format string, a ...interface{}) error
- func (job *QorJobInstance) FetchAndSetStatus() (string, error)
- func (job *QorJobInstance) GetHandler() JobHandler
- func (job *QorJobInstance) GetJobInfo() (ji *JobInfo, err error)
- func (job *QorJobInstance) GetStatus() string
- func (job *QorJobInstance) SetProgress(progress uint) error
- func (job *QorJobInstance) SetProgressText(s string) error
- func (job *QorJobInstance) SetStatus(status string) error
- func (job *QorJobInstance) StartRefresh()
- func (job *QorJobInstance) StopRefresh()
- type QorJobInterface
- type QorJobLog
- type QueJobInterface
- type Queue
- type Schedule
- type Scheduler
Constants ¶
View Source
const ( ActionJobInputParams = "worker_action_job_input_params" ActionJobCreate = "worker_action_job_create" ActionJobResponse = "worker_action_job_response" ActionJobClose = "worker_action_job_close" ActionJobProgressing = "worker_action_job_progressing" )
View Source
const ( // JobStatusNew job status new JobStatusNew = "new" // JobStatusScheduled job status scheduled JobStatusScheduled = "scheduled" // JobStatusRunning job status running JobStatusRunning = "running" // JobStatusCancelled job status cancelled JobStatusCancelled = "cancelled" // JobStatusDone job status done JobStatusDone = "done" // JobStatusException job status exception JobStatusException = "exception" // JobStatusKilled job status killed JobStatusKilled = "killed" )
View Source
const I18nWorkerKey i18n.ModuleKey = "I18nWorkerKey"
View Source
const (
PermEdit = "perm_worker_edit"
)
examples:. permPolicy.On("*") permPolicy.On("workers:upload_posts")
Variables ¶
View Source
var ( DefaultOriginalPageContextHandler = func(ctx *web.EventContext) map[string]interface{} { return map[string]interface{}{ "URL": ctx.R.Header.Get("Referer"), } } )
View Source
var Messages_en_US = &Messages{
StatusNew: "New",
StatusScheduled: "Scheduled",
StatusRunning: "Running",
StatusCancelled: "Cancelled",
StatusDone: "Done",
StatusException: "Exception",
StatusKilled: "Killed",
FilterTabAll: "All Jobs",
FilterTabRunning: "Running",
FilterTabScheduled: "Scheduled",
FilterTabDone: "Done",
FilterTabErrors: "Errors",
ActionCancelJob: "Cancel Job",
ActionAbortJob: "Abort Job",
ActionUpdateJob: "Update Job",
ActionRerunJob: "Rerun Job",
DetailTitleStatus: "Status",
DetailTitleLog: "Log",
NoticeJobCannotBeAborted: "This job cannot be aborted/canceled/updated due to its status change",
NoticeJobWontBeExecuted: "This job won't be executed due to code being deleted/modified",
ScheduleTime: "Schedule Time",
DateTimePickerClearText: "Clear",
DateTimePickerOkText: "OK",
PleaseSelectJob: "Please select job",
}
View Source
var Messages_zh_CN = &Messages{
StatusNew: "新建",
StatusScheduled: "计划",
StatusRunning: "运行中",
StatusCancelled: "取消",
StatusDone: "完成",
StatusException: "错误",
StatusKilled: "中止",
FilterTabAll: "全部",
FilterTabRunning: "运行中",
FilterTabScheduled: "计划",
FilterTabDone: "完成",
FilterTabErrors: "错误",
ActionCancelJob: "取消Job",
ActionAbortJob: "中止Job",
ActionUpdateJob: "更新Job",
ActionRerunJob: "重跑Job",
DetailTitleStatus: "状态",
DetailTitleLog: "日志",
NoticeJobCannotBeAborted: "Job状态已经改变,不能被中止/取消/更新",
NoticeJobWontBeExecuted: "Job代码被删除/修改, 这个Job不会被执行",
ScheduleTime: "执行时间",
DateTimePickerClearText: "清空",
DateTimePickerOkText: "确定",
PleaseSelectJob: "请选择Job",
}
Functions ¶
This section is empty.
Types ¶
type ActionJobBuilder ¶
type ActionJobBuilder struct {
// contains filtered or unexported fields
}
func (*ActionJobBuilder) ContextHandler ¶
func (action *ActionJobBuilder) ContextHandler(handler func(*web.EventContext) map[string]interface{}) *ActionJobBuilder
func (*ActionJobBuilder) Description ¶
func (action *ActionJobBuilder) Description(description string) *ActionJobBuilder
func (*ActionJobBuilder) DisplayLog ¶
func (action *ActionJobBuilder) DisplayLog(b bool) *ActionJobBuilder
func (ActionJobBuilder) GetParamsModelBuilder ¶
func (action ActionJobBuilder) GetParamsModelBuilder() *presets.ModelBuilder
func (*ActionJobBuilder) Global ¶
func (action *ActionJobBuilder) Global(b bool) *ActionJobBuilder
func (*ActionJobBuilder) Params ¶
func (action *ActionJobBuilder) Params(params interface{}) *ActionJobBuilder
func (*ActionJobBuilder) ProgressingInterval ¶
func (action *ActionJobBuilder) ProgressingInterval(interval int) *ActionJobBuilder
func (ActionJobBuilder) URL ¶
func (action ActionJobBuilder) URL() string
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) ActionJob ¶
func (b *Builder) ActionJob(jobName string, model *presets.ModelBuilder, hander JobHandler) *ActionJobBuilder
func (*Builder) Activity ¶
func (b *Builder) Activity(ab *activity.ActivityBuilder) *Builder
Activity sets Activity Builder to log activities
func (*Builder) GetCurrentUserIDFunc ¶
func (*Builder) NewJob ¶
func (b *Builder) NewJob(name string) *JobBuilder
type GoQueError ¶
type JobBuilder ¶
type JobBuilder struct {
// contains filtered or unexported fields
}
func (*JobBuilder) ContextHandler ¶
func (jb *JobBuilder) ContextHandler(handler func(*web.EventContext) map[string]interface{}) *JobBuilder
func (*JobBuilder) GetResourceBuilder ¶
func (jb *JobBuilder) GetResourceBuilder() *presets.ModelBuilder
func (*JobBuilder) Handler ¶
func (jb *JobBuilder) Handler(h JobHandler) *JobBuilder
func (*JobBuilder) Resource ¶
func (jb *JobBuilder) Resource(r interface{}) *JobBuilder
r should be ptr to struct
type JobHandler ¶
type JobHandler func(context.Context, QorJobInterface) error
type Messages ¶
type Messages struct { StatusNew string StatusScheduled string StatusRunning string StatusCancelled string StatusDone string StatusException string StatusKilled string FilterTabAll string FilterTabRunning string FilterTabScheduled string FilterTabDone string FilterTabErrors string ActionCancelJob string ActionAbortJob string ActionUpdateJob string ActionRerunJob string DetailTitleStatus string DetailTitleLog string NoticeJobCannotBeAborted string NoticeJobWontBeExecuted string ScheduleTime string DateTimePickerClearText string DateTimePickerOkText string PleaseSelectJob string }
type QorJobDefinition ¶
type QorJobDefinition struct { Name string Handler JobHandler }
type QorJobInstance ¶
type QorJobInstance struct { gorm.Model QorJobID uint `gorm:"index"` Operator string Job string Status string `sql:"default:'new'"` Args string Context string Progress uint ProgressText string // contains filtered or unexported fields }
func (*QorJobInstance) AddLog ¶
func (job *QorJobInstance) AddLog(log string) error
func (*QorJobInstance) AddLogf ¶
func (job *QorJobInstance) AddLogf(format string, a ...interface{}) error
func (*QorJobInstance) FetchAndSetStatus ¶
func (job *QorJobInstance) FetchAndSetStatus() (string, error)
func (*QorJobInstance) GetHandler ¶
func (job *QorJobInstance) GetHandler() JobHandler
func (*QorJobInstance) GetJobInfo ¶
func (job *QorJobInstance) GetJobInfo() (ji *JobInfo, err error)
func (*QorJobInstance) GetStatus ¶
func (job *QorJobInstance) GetStatus() string
func (*QorJobInstance) SetProgress ¶
func (job *QorJobInstance) SetProgress(progress uint) error
func (*QorJobInstance) SetProgressText ¶
func (job *QorJobInstance) SetProgressText(s string) error
func (*QorJobInstance) SetStatus ¶
func (job *QorJobInstance) SetStatus(status string) error
func (*QorJobInstance) StartRefresh ¶
func (job *QorJobInstance) StartRefresh()
func (*QorJobInstance) StopRefresh ¶
func (job *QorJobInstance) StopRefresh()
type QorJobInterface ¶
type QorJobInterface interface { GetJobInfo() (*JobInfo, error) SetProgress(uint) error SetProgressText(string) error AddLog(string) error AddLogf(format string, a ...interface{}) error }
for job handler
type QueJobInterface ¶
type QueJobInterface interface { QorJobInterface GetStatus() string FetchAndSetStatus() (string, error) SetStatus(string) error StartRefresh() StopRefresh() GetHandler() JobHandler }
type Queue ¶
type Queue interface { Add(QueJobInterface) error Kill(QueJobInterface) error Remove(QueJobInterface) error Listen(jobDefs []*QorJobDefinition, getJob func(qorJobID uint) (QueJobInterface, error)) error }
func NewGoQueQueue ¶
type Schedule ¶
Schedule could be embedded as job argument, then the job will get run as scheduled feature
func (*Schedule) GetScheduleTime ¶
GetScheduleTime get scheduled time
func (*Schedule) SetScheduleTime ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.