Versions in this module Expand all Collapse all v3 v3.0.3 Sep 27, 2024 v3.0.2 Jul 17, 2024 Changes in this version type Job + func TestInjectJobConn(j *Job, conn *pgxpool.Conn) *Job + func TestInjectJobTx(j *Job, tx Txer) *Job v3.0.1 Jul 17, 2024 Changes in this version + var ErrAgain = errors.New("maximum number of LockJob attempts reached") + var ErrMissingType = errors.New("job type must be specified") + func PrepareStatements(ctx context.Context, conn *pgx.Conn) error + type Client struct + func NewClient(pool *pgxpool.Pool) (*Client, error) + func (c *Client) Close(ctx context.Context) + func (c *Client) Enqueue(ctx context.Context, j *Job) error + func (c *Client) EnqueueInTx(ctx context.Context, j *Job, tx pgx.Tx) error + func (c *Client) LockJob(ctx context.Context, queue string) (*Job, error) + func (c *Client) Stats(ctx context.Context) (results []JobStats, err error) + type Job struct + Args []byte + ErrorCount int32 + ID int64 + LastError sql.NullString + Priority int16 + Queue string + RunAt time.Time + Type string + func (j *Job) Conn() *pgxpool.Conn + func (j *Job) Delete(ctx context.Context) error + func (j *Job) Done(ctx context.Context) + func (j *Job) Error(ctx context.Context, msg string) error + func (j *Job) Tx() Txer + type JobStats struct + Count int + CountErrored int + CountWorking int + HighestErrorCount int + OldestRunAt time.Time + Queue string + Type string + type Queryer interface + Begin func(ctx context.Context) (pgx.Tx, error) + Exec func(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) + Query func(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) + QueryRow func(ctx context.Context, sql string, args ...interface{}) pgx.Row + type Txer interface + Commit func(ctx context.Context) error + Rollback func(ctx context.Context) error + type WorkFunc func(j *Job) error + type WorkMap map[string]WorkFunc + type Worker struct + Interval time.Duration + Queue string + func NewWorker(c *Client, m WorkMap) *Worker + func (w *Worker) Shutdown() + func (w *Worker) Work(ctx context.Context) + func (w *Worker) WorkOne(ctx context.Context) (didWork bool) + type WorkerPool struct + Interval time.Duration + Queue string + WorkMap WorkMap + func NewWorkerPool(c *Client, wm WorkMap, count int) *WorkerPool + func (w *WorkerPool) Shutdown() + func (w *WorkerPool) Start(ctx context.Context) Other modules containing this package github.com/kanmu/qg github.com/kanmu/qg/v4 github.com/kanmu/qg/v5