Documentation
¶
Index ¶
- type Client
- func (c *Client) Cancel(ctx context.Context, id string) (any, error)
- func (c *Client) Get(ctx context.Context, id string) (any, error)
- func (r Client) Register(name string, w WorkerFn, opts ...WorkerOptionFunc)
- func (c *Client) Schedule(ctx context.Context, id string, queueName string, arguments interface{}, ...) (any, error)
- func (c *Client) ScheduleNow(ctx context.Context, id string) (any, error)
- func (c *Client) Start() error
- func (c *Client) Stop()
- func (c *Client) WithTx(tx *sql.Tx) Tx
- type ClientOptionFunc
- type FnOptions
- type Handler
- type Mutate
- type Options
- type Queue
- type Spawner
- type Tx
- type Worker
- type WorkerFn
- type WorkerOptionFunc
- func WithCallbackFailed(fn func(ctx context.Context, job job.Job, err error) (any, error)) WorkerOptionFunc
- func WithCallbackSuccess(fn func(ctx context.Context, job job.Job, res any) (any, error)) WorkerOptionFunc
- func WithInstances(i int) WorkerOptionFunc
- func WithTimeout(t time.Duration) WorkerOptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opt *Options, options ...ClientOptionFunc) *Client
func (Client) Register ¶
func (r Client) Register(name string, w WorkerFn, opts ...WorkerOptionFunc)
func (*Client) ScheduleNow ¶
type ClientOptionFunc ¶
func WithErrHandler ¶
func WithErrHandler(fn func(error)) ClientOptionFunc
func WithReaperInterval ¶
func WithReaperInterval(t time.Duration) ClientOptionFunc
func WithSetTableName ¶ added in v1.1.3
func WithSetTableName(table string) ClientOptionFunc
func WithSleepInterval ¶
func WithSleepInterval(t time.Duration) ClientOptionFunc
type Mutate ¶
func (*Mutate) Update ¶
Update updates the given job in the database within a transaction. It wraps the update operation in a transaction context and ensures that the transaction is properly managed.
Parameters:
- ctx: The context for the update operation.
- j: The job to be updated.
Returns:
- error: An error if the update operation fails, otherwise nil.
type Tx ¶
type Tx interface {
Schedule(ctx context.Context, id string, queueName string, arguments interface{}, options ...FnOptions) error
Cancel(ctx context.Context, id string) error
ScheduleNow(ctx context.Context, id string) error
Get(ctx context.Context, id string) (*job.Job, error)
Poll(ctx context.Context, queueName string) (*job.Job, error)
Update(ctx context.Context, job job.Job) error
RequeueTimeout(ctx context.Context, queueName string, timeout time.Time) error
}
type WorkerOptionFunc ¶
type WorkerOptionFunc func(registerConfig) registerConfig
func WithCallbackFailed ¶ added in v1.1.5
func WithCallbackSuccess ¶ added in v1.1.5
func WithInstances ¶
func WithInstances(i int) WorkerOptionFunc
func WithTimeout ¶
func WithTimeout(t time.Duration) WorkerOptionFunc
Source Files
¶
Click to show internal directories.
Click to hide internal directories.