queue

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJobIdsNotProvided = fmt.Errorf("job ids not provided")
	ErrJobNotFound       = fmt.Errorf("job not found")
)

Functions

This section is empty.

Types

type JobStatus

type JobStatus struct {
	JobID  int64
	Status rivertype.JobState
}

type Options

type Options struct {
	ScheduledAt time.Time
	MaxAttempts int
	Metadata    []byte
	Pending     bool
	Priority    int
	Queue       string
	Tags        []string
	UniqueOpts  river.UniqueOpts
}

type Repository

type Repository[T river.JobArgs] struct {
	// contains filtered or unexported fields
}

func New

func New[T river.JobArgs](river *river.Client[pgx.Tx]) *Repository[T]

func (*Repository[T]) FetchJob

func (r *Repository[T]) FetchJob(ctx context.Context, id int64) (*rivertype.JobRow, error)

func (*Repository[T]) FetchJobs

func (r *Repository[T]) FetchJobs(ctx context.Context, ids ...int64) ([]*rivertype.JobRow, error)

func (*Repository[T]) JobStatuses

func (r *Repository[T]) JobStatuses(ctx context.Context, ids ...int64) ([]JobStatus, error)

func (*Repository[T]) Put

func (r *Repository[T]) Put(ctx context.Context, args T) (int64, error)

func (*Repository[T]) PutBatch

func (r *Repository[T]) PutBatch(ctx context.Context, args ...T) ([]int64, error)

func (*Repository[T]) PutBatchWithOpts

func (r *Repository[T]) PutBatchWithOpts(ctx context.Context, options Options, args ...T) ([]int64, error)

func (*Repository[T]) PutWithOpts

func (r *Repository[T]) PutWithOpts(ctx context.Context, options Options, args T) (int64, error)

type Worker

type Worker[T river.JobArgs] interface {
	Put(ctx context.Context, args T) (int64, error)
	PutBatch(ctx context.Context, args ...T) ([]int64, error)
	PutWithOpts(ctx context.Context, options Options, args T) (int64, error)
	PutBatchWithOpts(ctx context.Context, options Options, args ...T) ([]int64, error)
	JobStatuses(ctx context.Context, ids ...int64) ([]JobStatus, error)
	FetchJobs(ctx context.Context, ids ...int64) ([]*rivertype.JobRow, error)
	FetchJob(ctx context.Context, id int64) (*rivertype.JobRow, error)
}

Jump to

Keyboard shortcuts

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