func (opt *JobOptions) AddHandleMiddleware(mw HandleMiddleware) *JobOptions {
	opt.HandleMiddleware = append(opt.HandleMiddleware, mw)
	return opt
}
AddHandleMiddleware adds HandleMiddleware.
package work
import (
	"context"
	"errors"
	"fmt"
	"runtime/debug"
	"sync"
	"time"
	"github.com/cenkalti/backoff/v4"
)
type DequeueFunc func(*DequeueOptions) (*Job, error)
type DequeueMiddleware func(DequeueFunc) DequeueFunc
type EnqueueFunc func(*Job, *EnqueueOptions) error
type EnqueueMiddleware func(EnqueueFunc) EnqueueFunc
type HandleFunc func(*Job, *DequeueOptions) error
type ContextHandleFunc func(context.Context, *Job, *DequeueOptions) error
type HandleMiddleware func(HandleFunc) HandleFunc
type BackoffFunc func(*Job, *DequeueOptions) time.Duration
type handler struct {
	QueueID    string
	HandleFunc ContextHandleFunc
	JobOptions JobOptions
}
type WorkerOptions struct {
	Namespace string
	Queue     Queue
	ErrorFunc func(error)
}
type Worker struct {
	opt WorkerOptions
	cancel     func()
	wg         sync.WaitGroup
	handlerMap map[string]handler
}
func NewWorker(opt *WorkerOptions) *Worker {
	return &Worker{
		opt:        *opt,
		handlerMap: make(map[string]handler),
	}
}
type JobOptions struct {
	MaxExecutionTime time.Duration
	IdleWait         time.Duration
	NumGoroutines    int64
	Backoff          BackoffFunc
	DequeueMiddleware []DequeueMiddleware
	HandleMiddleware  []HandleMiddleware
}
func (opt *JobOptions) AddDequeueMiddleware(mw DequeueMiddleware) *JobOptions {
	opt.DequeueMiddleware = append(opt.DequeueMiddleware, mw)
	return opt
}