client

package
v0.0.0-...-c07ec26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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(database *sql.DB) *Client

func (Client) Cancel

func (c Client) Cancel(ctx context.Context, id string) error

Cancel cancels a job in the queue if not already executed

func (Client) Get

func (c Client) Get(ctx context.Context, id string) (jobs.Job, error)

Get returns job with the given id

func (Client) Schedule

func (c Client) Schedule(ctx context.Context, id string, queueName string, arguments interface{}, options ...OptionFunc) error

Schedule schedules a job in the queue to be executed as soon as possible

func (Client) ScheduleNow

func (c Client) ScheduleNow(ctx context.Context, id string) error

ScheduleNow reschedules a job in the queue to be executed immediately

func (Client) WithTx

func (c Client) WithTx(tx *sql.Tx) TxClient

WithTx returns a new client with the given transaction

type OptionFunc

type OptionFunc func(j jobs.Job) jobs.Job

func WithMaxRetries

func WithMaxRetries(tries int) OptionFunc

func WithRetryInterval

func WithRetryInterval(interval time.Duration) OptionFunc

func WithScheduleTime

func WithScheduleTime(t time.Time) OptionFunc

type TxClient

type TxClient interface {
	Schedule(ctx context.Context, id string, queueName string, arguments interface{}, options ...OptionFunc) error
	Cancel(ctx context.Context, id string) error
	ScheduleNow(ctx context.Context, id string) error
	Get(ctx context.Context, id string) (jobs.Job, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL