Versions in this module Expand all Collapse all v0 v0.1.0 Sep 29, 2024 Changes in this version + var ErrExistedJob = errors.New("existed job") + type Job struct + func NewJob(f func(ctx context.Context) *JobResult) *Job + func (j *Job) Exec(ctx context.Context) *JobResult + func (j *Job) GetResult() *JobResult + func (j *Job) IsCompleted() bool + func (j *Job) WaitResult(ctx context.Context) *JobResult + type JobManager struct + func New() *JobManager + func (m *JobManager) AddPriority(p Priority) + func (m *JobManager) Hook(trigger func(ctx context.Context, job JobWrapper)) + func (m *JobManager) RefreshEvery(interval time.Duration) + func (m *JobManager) Run(ctx context.Context, numThreads int) error + func (m *JobManager) RunOne(ctx context.Context) error + func (m *JobManager) Schedule(priority Priority, job *Job) error + func (m *JobManager) SetDefaultJobAging(timeslice time.Duration) + type JobResult struct + DoneAt time.Time + Err error + func EmptyResult() *JobResult + func Err(err error) *JobResult + func Result(value any) *JobResult + func (r *JobResult) Set(key, value any) *JobResult + func (r JobResult) Get(key any) any + func (r JobResult) GetBool(key any) bool + func (r JobResult) GetFloat32(key any) float32 + func (r JobResult) GetFloat64(key any) float64 + func (r JobResult) GetInt(key any) int + func (r JobResult) GetInt32(key any) int32 + func (r JobResult) GetInt64(key any) int64 + func (r JobResult) GetString(key any) string + func (r JobResult) GetUint(key any) uint + func (r JobResult) GetUint32(key any) uint32 + func (r JobResult) GetUint64(key any) uint64 + func (r JobResult) Has(key any) bool + type JobWrapper struct + OriginalPriority Priority + Priority Priority + func (w JobWrapper) Unwrap() *Job + type Priority struct + func NewPriority(name string, p int) Priority + func (p Priority) Name() string + func (p Priority) String() string + func (p Priority) Value() int + func (p Priority) WithAging(timeslice time.Duration) Priority + func (p Priority) WithNoAging() Priority