Versions in this module Expand all Collapse all v0 v0.52.0 Oct 18, 2026 v0.51.0 Oct 18, 2026 v0.50.0 Oct 16, 2026 Changes in this version + const FetchCooldownDefault + const FetchCooldownMin + const FetchPollIntervalDefault + const FetchPollIntervalMin + const JobStuckThresholdDefault + const JobTimeoutDefault + const MaxAttemptsDefault + const PriorityDefault + const QueueDefault + const QueueNumWorkersMax + var ErrJobCancelledRemotely = rivertype.ErrJobCancelledRemotely + var ErrNotFound = rivertype.ErrNotFound + func AddWorkerArgs[T JobArgs](workers *Workers, jobArgs T, worker Worker[T]) + func AddWorkerSafely[T JobArgs](workers *Workers, worker Worker[T]) error + func AddWorker[T JobArgs](workers *Workers, worker Worker[T]) + func JobCancel(err error) error + func JobSnooze(duration time.Duration) error + func MetadataSet(ctx context.Context, key string, value any) error + func RecordOutput(ctx context.Context, output any) error + func ReindexerIndexNamesDefault() []string + func ResumableSetCursor[TCursor any](ctx context.Context, cursor TCursor) error + func ResumableStep(ctx context.Context, name string, opts *StepOpts, ...) + func ResumableStepCursor[TCursor any](ctx context.Context, name string, opts *StepOpts, ...) + type Client struct + func ClientFromContextSafely[TTx any](ctx context.Context) (*Client[TTx], error) + func ClientFromContext[TTx any](ctx context.Context) *Client[TTx] + func NewClient[TTx any](driver riverdriver.Driver[TTx], config *Config) (*Client[TTx], error) + func (c *Client[TTx]) Driver() riverdriver.Driver[TTx] + func (c *Client[TTx]) ID() string + func (c *Client[TTx]) Insert(ctx context.Context, args JobArgs, opts *InsertOpts) (*rivertype.JobInsertResult, error) + func (c *Client[TTx]) InsertMany(ctx context.Context, params []InsertManyParams) ([]*rivertype.JobInsertResult, error) + func (c *Client[TTx]) InsertManyFast(ctx context.Context, params []InsertManyParams) (int, error) + func (c *Client[TTx]) InsertManyFastTx(ctx context.Context, tx TTx, params []InsertManyParams) (int, error) + func (c *Client[TTx]) InsertManyTx(ctx context.Context, tx TTx, params []InsertManyParams) ([]*rivertype.JobInsertResult, error) + func (c *Client[TTx]) InsertTx(ctx context.Context, tx TTx, args JobArgs, opts *InsertOpts) (*rivertype.JobInsertResult, error) + func (c *Client[TTx]) JobCancel(ctx context.Context, jobID int64) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobCancelTx(ctx context.Context, tx TTx, jobID int64) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobDelete(ctx context.Context, id int64) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobDeleteMany(ctx context.Context, params *JobDeleteManyParams) (*JobDeleteManyResult, error) + func (c *Client[TTx]) JobDeleteManyTx(ctx context.Context, tx TTx, params *JobDeleteManyParams) (*JobDeleteManyResult, error) + func (c *Client[TTx]) JobDeleteTx(ctx context.Context, tx TTx, id int64) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobGet(ctx context.Context, id int64) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobGetTx(ctx context.Context, tx TTx, id int64) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobList(ctx context.Context, params *JobListParams) (*JobListResult, error) + func (c *Client[TTx]) JobListTx(ctx context.Context, tx TTx, params *JobListParams) (*JobListResult, error) + func (c *Client[TTx]) JobRetry(ctx context.Context, id int64) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobRetryTx(ctx context.Context, tx TTx, id int64) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobUpdate(ctx context.Context, id int64, params *JobUpdateParams) (*rivertype.JobRow, error) + func (c *Client[TTx]) JobUpdateTx(ctx context.Context, tx TTx, id int64, params *JobUpdateParams) (*rivertype.JobRow, error) + func (c *Client[TTx]) Notify() *ClientNotifyBundle[TTx] + func (c *Client[TTx]) PeriodicJobs() *PeriodicJobBundle + func (c *Client[TTx]) Pilot() riverpilot.Pilot + func (c *Client[TTx]) QueueGet(ctx context.Context, name string) (*rivertype.Queue, error) + func (c *Client[TTx]) QueueGetTx(ctx context.Context, tx TTx, name string) (*rivertype.Queue, error) + func (c *Client[TTx]) QueueList(ctx context.Context, params *QueueListParams) (*QueueListResult, error) + func (c *Client[TTx]) QueueListTx(ctx context.Context, tx TTx, params *QueueListParams) (*QueueListResult, error) + func (c *Client[TTx]) QueuePause(ctx context.Context, name string, opts *QueuePauseOpts) error + func (c *Client[TTx]) QueuePauseTx(ctx context.Context, tx TTx, name string, opts *QueuePauseOpts) error + func (c *Client[TTx]) QueueResume(ctx context.Context, name string, opts *QueuePauseOpts) error + func (c *Client[TTx]) QueueResumeTx(ctx context.Context, tx TTx, name string, opts *QueuePauseOpts) error + func (c *Client[TTx]) QueueUpdate(ctx context.Context, name string, params *QueueUpdateParams) (*rivertype.Queue, error) + func (c *Client[TTx]) QueueUpdateTx(ctx context.Context, tx TTx, name string, params *QueueUpdateParams) (*rivertype.Queue, error) + func (c *Client[TTx]) Queues() *QueueBundle + func (c *Client[TTx]) Schema() string + func (c *Client[TTx]) Start(ctx context.Context) error + func (c *Client[TTx]) Stop(ctx context.Context) error + func (c *Client[TTx]) StopAndCancel(ctx context.Context) error + func (c *Client[TTx]) Stopped() <-chan struct{} + func (c *Client[TTx]) Subscribe(kinds ...EventKind) (<-chan *Event, func()) + func (c *Client[TTx]) SubscribeConfig(config *SubscribeConfig) (<-chan *Event, func()) + type ClientNotifyBundle struct + func (c *ClientNotifyBundle[TTx]) RequestResign(ctx context.Context) error + func (c *ClientNotifyBundle[TTx]) RequestResignTx(ctx context.Context, tx TTx) error + type ClientRetryPolicy interface + NextRetry func(job *rivertype.JobRow) time.Time + type Config struct + AdvisoryLockPrefix int32 + CancelledJobRetentionPeriod time.Duration + CompletedJobRetentionPeriod time.Duration + DiscardedJobRetentionPeriod time.Duration + ErrorHandler ErrorHandler + FetchCooldown time.Duration + FetchOnlyKnownKinds bool + FetchPollInterval time.Duration + Hooks []rivertype.Hook + ID string + JobCleanerTimeout time.Duration + JobInsertMiddleware []rivertype.JobInsertMiddleware + JobStuckHandler JobStuckHandler + JobStuckThreshold time.Duration + JobTimeout time.Duration + LeaderElectionDisabled bool + Logger *slog.Logger + MaxAttempts int + Middleware []rivertype.Middleware + PeriodicJobs []*PeriodicJob + Plugins []rivertype.Plugin + PollOnly bool + Queues map[string]QueueConfig + ReindexerIndexNames []string + ReindexerSchedule PeriodicSchedule + ReindexerTimeout time.Duration + RescueStuckJobsAfter time.Duration + RetryPolicy ClientRetryPolicy + Schema string + SkipJobKindValidation bool + SkipUnknownJobCheck bool + SoftStopTimeout time.Duration + Test TestConfig + TestOnly bool + WorkerMiddleware []rivertype.WorkerMiddleware + Workers *Workers + func (c *Config) WithDefaults() *Config + type DefaultClientRetryPolicy struct + func (p *DefaultClientRetryPolicy) NextRetry(job *rivertype.JobRow) time.Time + type ErrorHandler interface + HandleError func(ctx context.Context, job *rivertype.JobRow, err error) *ErrorHandlerResult + HandlePanic func(ctx context.Context, job *rivertype.JobRow, panicVal any, trace string) *ErrorHandlerResult + type ErrorHandlerResult struct + SetCancelled bool + type Event struct + Job *rivertype.JobRow + JobStats *JobStatistics + Kind EventKind + Queue *rivertype.Queue + type EventKind string + const EventKindJobCancelled + const EventKindJobCompleted + const EventKindJobFailed + const EventKindJobInterrupted + const EventKindJobSnoozed + const EventKindQueuePaused + const EventKindQueueResumed + type HookDefaults struct + func (d *HookDefaults) IsHook() bool + func (d *HookDefaults) IsPlugin() bool + type HookInsertBeginFunc func(ctx context.Context, params *rivertype.JobInsertParams) error + func (f HookInsertBeginFunc) InsertBegin(ctx context.Context, params *rivertype.JobInsertParams) error + func (f HookInsertBeginFunc) IsHook() bool + func (f HookInsertBeginFunc) IsPlugin() bool + type HookMetricEmitFunc func(ctx context.Context, params *rivertype.HookMetricEmitParams) + func (f HookMetricEmitFunc) IsHook() bool + func (f HookMetricEmitFunc) IsPlugin() bool + func (f HookMetricEmitFunc) MetricEmit(ctx context.Context, params *rivertype.HookMetricEmitParams) + type HookPeriodicJobsStartFunc func(ctx context.Context, params *rivertype.HookPeriodicJobsStartParams) error + func (f HookPeriodicJobsStartFunc) IsHook() bool + func (f HookPeriodicJobsStartFunc) IsPlugin() bool + func (f HookPeriodicJobsStartFunc) Start(ctx context.Context, params *rivertype.HookPeriodicJobsStartParams) error + type HookWorkBeginFunc func(ctx context.Context, job *rivertype.JobRow) error + func (f HookWorkBeginFunc) IsHook() bool + func (f HookWorkBeginFunc) IsPlugin() bool + func (f HookWorkBeginFunc) WorkBegin(ctx context.Context, job *rivertype.JobRow) error + type HookWorkEndFunc func(ctx context.Context, job *rivertype.JobRow, err error) error + func (f HookWorkEndFunc) IsHook() bool + func (f HookWorkEndFunc) IsPlugin() bool + func (f HookWorkEndFunc) WorkEnd(ctx context.Context, job *rivertype.JobRow, err error) error + type InsertManyParams struct + Args JobArgs + InsertOpts *InsertOpts + type InsertOpts struct + MaxAttempts int + Metadata []byte + Pending bool + Priority int + Queue string + ScheduledAt time.Time + Tags []string + UniqueOpts UniqueOpts + type Job struct + Args T + func JobCompleteTx[TDriver riverdriver.Driver[TTx], TTx any, TArgs JobArgs](ctx context.Context, tx TTx, job *Job[TArgs]) (*Job[TArgs], error) + func ResumableSetStepCursorTx[TDriver riverdriver.Driver[TTx], TTx any, TArgs JobArgs, TCursor any](ctx context.Context, tx TTx, job *Job[TArgs], cursor TCursor) (*Job[TArgs], error) + func ResumableSetStepTx[TDriver riverdriver.Driver[TTx], TTx any, TArgs JobArgs](ctx context.Context, tx TTx, job *Job[TArgs]) (*Job[TArgs], error) + type JobArgs interface + Kind func() string + type JobArgsWithHooks interface + Hooks func() []rivertype.Hook + type JobArgsWithInsertOpts interface + InsertOpts func() InsertOpts + type JobArgsWithKindAliases interface + KindAliases func() []string + type JobArgsWithPlugins interface + Plugins func() []rivertype.Plugin + type JobCancelError = rivertype.JobCancelError + type JobDeleteManyParams struct + func NewJobDeleteManyParams() *JobDeleteManyParams + func (p *JobDeleteManyParams) First(count int) *JobDeleteManyParams + func (p *JobDeleteManyParams) IDs(ids ...int64) *JobDeleteManyParams + func (p *JobDeleteManyParams) Kinds(kinds ...string) *JobDeleteManyParams + func (p *JobDeleteManyParams) Priorities(priorities ...int16) *JobDeleteManyParams + func (p *JobDeleteManyParams) Queues(queues ...string) *JobDeleteManyParams + func (p *JobDeleteManyParams) States(states ...rivertype.JobState) *JobDeleteManyParams + func (p *JobDeleteManyParams) UnsafeAll() *JobDeleteManyParams + type JobDeleteManyResult struct + Jobs []*rivertype.JobRow + type JobInsertMiddlewareDefaults struct + func (d *JobInsertMiddlewareDefaults) InsertMany(ctx context.Context, manyParams []*rivertype.JobInsertParams, ...) ([]*rivertype.JobInsertResult, error) + type JobInsertMiddlewareFunc func(ctx context.Context, manyParams []*rivertype.JobInsertParams, ...) ([]*rivertype.JobInsertResult, error) + func (f JobInsertMiddlewareFunc) InsertMany(ctx context.Context, manyParams []*rivertype.JobInsertParams, ...) ([]*rivertype.JobInsertResult, error) + func (f JobInsertMiddlewareFunc) IsMiddleware() bool + func (f JobInsertMiddlewareFunc) IsPlugin() bool + type JobListCursor struct + func JobListCursorFromJob(job *rivertype.JobRow) *JobListCursor + func (c *JobListCursor) UnmarshalText(text []byte) error + func (c JobListCursor) MarshalText() ([]byte, error) + type JobListOrderByField string + const JobListOrderByFinalizedAt + const JobListOrderByID + const JobListOrderByScheduledAt + const JobListOrderByTime + type JobListParams struct + func NewJobListParams() *JobListParams + func (p *JobListParams) After(cursor *JobListCursor) *JobListParams + func (p *JobListParams) First(count int) *JobListParams + func (p *JobListParams) IDs(ids ...int64) *JobListParams + func (p *JobListParams) Kinds(kinds ...string) *JobListParams + func (p *JobListParams) Metadata(json string) *JobListParams + func (p *JobListParams) OrderBy(field JobListOrderByField, direction SortOrder) *JobListParams + func (p *JobListParams) Priorities(priorities ...int16) *JobListParams + func (p *JobListParams) Queues(queues ...string) *JobListParams + func (p *JobListParams) States(states ...rivertype.JobState) *JobListParams + func (p *JobListParams) TagsAll(tags ...string) *JobListParams + func (p *JobListParams) TagsAny(tags ...string) *JobListParams + func (p *JobListParams) Where(sql string, namedArgsMany ...NamedArgs) *JobListParams + type JobListResult struct + Jobs []*rivertype.JobRow + LastCursor *JobListCursor + type JobSnoozeError = rivertype.JobSnoozeError + type JobStatistics struct + CompleteDuration time.Duration + QueueWaitDuration time.Duration + RunDuration time.Duration + type JobStuckHandler func(ctx context.Context, params JobStuckHandlerParams) JobStuckHandlerResult + type JobStuckHandlerParams struct + ID int64 + Kind string + Queue string + TotalStuckJobs int + type JobStuckHandlerResult struct + AddWorkerSlot bool + type JobUpdateParams struct + Output any + type MiddlewareDefaults struct + func (d *MiddlewareDefaults) IsMiddleware() bool + func (d *MiddlewareDefaults) IsPlugin() bool + type NamedArgs map[string]any + type PeriodicJob struct + func NewPeriodicJob(scheduleFunc PeriodicSchedule, constructorFunc PeriodicJobConstructor, ...) *PeriodicJob + type PeriodicJobBundle struct + func (b *PeriodicJobBundle) Add(periodicJob *PeriodicJob) rivertype.PeriodicJobHandle + func (b *PeriodicJobBundle) AddMany(periodicJobs []*PeriodicJob) []rivertype.PeriodicJobHandle + func (b *PeriodicJobBundle) AddManySafely(periodicJobs []*PeriodicJob) ([]rivertype.PeriodicJobHandle, error) + func (b *PeriodicJobBundle) AddSafely(periodicJob *PeriodicJob) (rivertype.PeriodicJobHandle, error) + func (b *PeriodicJobBundle) Clear() + func (b *PeriodicJobBundle) Remove(periodicJobHandle rivertype.PeriodicJobHandle) + func (b *PeriodicJobBundle) RemoveByID(id string) bool + func (b *PeriodicJobBundle) RemoveMany(periodicJobHandles []rivertype.PeriodicJobHandle) + func (b *PeriodicJobBundle) RemoveManyByID(ids []string) + type PeriodicJobConstructor func() (JobArgs, *InsertOpts) + type PeriodicJobOpts struct + ID string + RunOnStart bool + type PeriodicSchedule interface + Next func(current time.Time) time.Time + func NeverSchedule() PeriodicSchedule + func PeriodicInterval(interval time.Duration) PeriodicSchedule + type PluginDefaults struct + func (d *PluginDefaults) IsPlugin() bool + type QueueAlreadyAddedError struct + Name string + func (e *QueueAlreadyAddedError) Error() string + func (e *QueueAlreadyAddedError) Is(target error) bool + type QueueBundle struct + func (b *QueueBundle) Add(queueName string, queueConfig QueueConfig) error + func (b *QueueBundle) Remove(ctx context.Context, queueName string) error + type QueueConfig struct + FetchCooldown time.Duration + FetchPollInterval time.Duration + MaxWorkers int + type QueueListParams struct + func NewQueueListParams() *QueueListParams + func (p *QueueListParams) First(count int) *QueueListParams + type QueueListResult struct + Queues []*rivertype.Queue + type QueueNotFoundError struct + Name string + func (e *QueueNotFoundError) Error() string + func (e *QueueNotFoundError) Is(target error) bool + type QueuePauseOpts struct + type QueueUpdateParams struct + Metadata []byte + type SortOrder int + const SortOrderAsc + const SortOrderDesc + type StepOpts struct + type SubscribeConfig struct + ChanSize int + Kinds []EventKind + type TestConfig struct + DisableUniqueEnforcement bool + Time rivertype.TimeGenerator + type UniqueOpts struct + ByArgs bool + ByPeriod time.Duration + ByQueue bool + ByState []rivertype.JobState + ExcludeKind bool + type UnknownJobKindError = rivertype.UnknownJobKindError + type Worker interface + Middleware func(job *rivertype.JobRow) []rivertype.WorkerMiddleware + NextRetry func(job *Job[T]) time.Time + Timeout func(job *Job[T]) time.Duration + Work func(ctx context.Context, job *Job[T]) error + func WorkFunc[T JobArgs](f func(context.Context, *Job[T]) error) Worker[T] + type WorkerDefaults struct + func (w WorkerDefaults[T]) Middleware(*rivertype.JobRow) []rivertype.WorkerMiddleware + func (w WorkerDefaults[T]) NextRetry(*Job[T]) time.Time + func (w WorkerDefaults[T]) Timeout(*Job[T]) time.Duration + type WorkerMiddlewareDefaults struct + func (d *WorkerMiddlewareDefaults) Work(ctx context.Context, job *rivertype.JobRow, ...) error + type WorkerMiddlewareFunc func(ctx context.Context, job *rivertype.JobRow, ...) error + func (f WorkerMiddlewareFunc) IsMiddleware() bool + func (f WorkerMiddlewareFunc) IsPlugin() bool + func (f WorkerMiddlewareFunc) Work(ctx context.Context, job *rivertype.JobRow, ...) error + type Workers struct + func NewWorkers() *Workers