Documentation
¶
Overview ¶
Package riverpgxv5 provides a River driver implementation for Pgx v5.
This is currently the only supported driver for River and will therefore be used by all projects using River, but the code is organized this way so that other database packages can be supported in future River versions.
Index ¶
- type Driver
- func (d *Driver) GetExecutor() riverdriver.Executor
- func (d *Driver) GetListener() riverdriver.Listener
- func (d *Driver) GetMigrationFS(line string) fs.FS
- func (d *Driver) GetMigrationLines() []string
- func (d *Driver) HasPool() bool
- func (d *Driver) SupportsListener() bool
- func (d *Driver) UnwrapExecutor(tx pgx.Tx) riverdriver.ExecutorTx
- type Executor
- func (e *Executor) Begin(ctx context.Context) (riverdriver.ExecutorTx, error)
- func (e *Executor) ColumnExists(ctx context.Context, tableName, columnName string) (bool, error)
- func (e *Executor) Exec(ctx context.Context, sql string) (struct{}, error)
- func (e *Executor) JobCancel(ctx context.Context, params *riverdriver.JobCancelParams) (*rivertype.JobRow, error)
- func (e *Executor) JobCountByState(ctx context.Context, state rivertype.JobState) (int, error)
- func (e *Executor) JobDelete(ctx context.Context, id int64) (*rivertype.JobRow, error)
- func (e *Executor) JobDeleteBefore(ctx context.Context, params *riverdriver.JobDeleteBeforeParams) (int, error)
- func (e *Executor) JobGetAvailable(ctx context.Context, params *riverdriver.JobGetAvailableParams) ([]*rivertype.JobRow, error)
- func (e *Executor) JobGetByID(ctx context.Context, id int64) (*rivertype.JobRow, error)
- func (e *Executor) JobGetByIDMany(ctx context.Context, id []int64) ([]*rivertype.JobRow, error)
- func (e *Executor) JobGetByKindAndUniqueProperties(ctx context.Context, params *riverdriver.JobGetByKindAndUniquePropertiesParams) (*rivertype.JobRow, error)
- func (e *Executor) JobGetByKindMany(ctx context.Context, kind []string) ([]*rivertype.JobRow, error)
- func (e *Executor) JobGetStuck(ctx context.Context, params *riverdriver.JobGetStuckParams) ([]*rivertype.JobRow, error)
- func (e *Executor) JobInsertFastMany(ctx context.Context, params []*riverdriver.JobInsertFastParams) ([]*riverdriver.JobInsertFastResult, error)
- func (e *Executor) JobInsertFastManyNoReturning(ctx context.Context, params []*riverdriver.JobInsertFastParams) (int, error)
- func (e *Executor) JobInsertFull(ctx context.Context, params *riverdriver.JobInsertFullParams) (*rivertype.JobRow, error)
- func (e *Executor) JobList(ctx context.Context, query string, namedArgs map[string]any) ([]*rivertype.JobRow, error)
- func (e *Executor) JobListFields() string
- func (e *Executor) JobRescueMany(ctx context.Context, params *riverdriver.JobRescueManyParams) (*struct{}, error)
- func (e *Executor) JobRetry(ctx context.Context, id int64) (*rivertype.JobRow, error)
- func (e *Executor) JobSchedule(ctx context.Context, params *riverdriver.JobScheduleParams) ([]*riverdriver.JobScheduleResult, error)
- func (e *Executor) JobSetStateIfRunningMany(ctx context.Context, params *riverdriver.JobSetStateIfRunningManyParams) ([]*rivertype.JobRow, error)
- func (e *Executor) JobUpdate(ctx context.Context, params *riverdriver.JobUpdateParams) (*rivertype.JobRow, error)
- func (e *Executor) LeaderAttemptElect(ctx context.Context, params *riverdriver.LeaderElectParams) (bool, error)
- func (e *Executor) LeaderAttemptReelect(ctx context.Context, params *riverdriver.LeaderElectParams) (bool, error)
- func (e *Executor) LeaderDeleteExpired(ctx context.Context) (int, error)
- func (e *Executor) LeaderGetElectedLeader(ctx context.Context) (*riverdriver.Leader, error)
- func (e *Executor) LeaderInsert(ctx context.Context, params *riverdriver.LeaderInsertParams) (*riverdriver.Leader, error)
- func (e *Executor) LeaderResign(ctx context.Context, params *riverdriver.LeaderResignParams) (bool, error)
- func (e *Executor) MigrationDeleteAssumingMainMany(ctx context.Context, versions []int) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationDeleteByLineAndVersionMany(ctx context.Context, line string, versions []int) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationGetAllAssumingMain(ctx context.Context) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationGetByLine(ctx context.Context, line string) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationInsertMany(ctx context.Context, line string, versions []int) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationInsertManyAssumingMain(ctx context.Context, versions []int) ([]*riverdriver.Migration, error)
- func (e *Executor) NotifyMany(ctx context.Context, params *riverdriver.NotifyManyParams) error
- func (e *Executor) PGAdvisoryXactLock(ctx context.Context, key int64) (*struct{}, error)
- func (e *Executor) QueueCreateOrSetUpdatedAt(ctx context.Context, params *riverdriver.QueueCreateOrSetUpdatedAtParams) (*rivertype.Queue, error)
- func (e *Executor) QueueDeleteExpired(ctx context.Context, params *riverdriver.QueueDeleteExpiredParams) ([]string, error)
- func (e *Executor) QueueGet(ctx context.Context, name string) (*rivertype.Queue, error)
- func (e *Executor) QueueList(ctx context.Context, limit int) ([]*rivertype.Queue, error)
- func (e *Executor) QueuePause(ctx context.Context, name string) error
- func (e *Executor) QueueResume(ctx context.Context, name string) error
- func (e *Executor) TableExists(ctx context.Context, tableName string) (bool, error)
- type ExecutorTx
- type Listener
- func (l *Listener) Close(ctx context.Context) error
- func (l *Listener) Connect(ctx context.Context) error
- func (l *Listener) Listen(ctx context.Context, topic string) error
- func (l *Listener) Ping(ctx context.Context) error
- func (l *Listener) Unlisten(ctx context.Context, topic string) error
- func (l *Listener) WaitForNotification(ctx context.Context) (*riverdriver.Notification, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is an implementation of riverdriver.Driver for Pgx v5.
func New ¶
New returns a new Pgx v5 River driver for use with River.
It takes a pgxpool.Pool to use for use with River. The pool should already be configured to use the schema specified in the client's Schema field. The pool must not be closed while associated River objects are running.
The database pool may be nil. If it is, a client that it's sent into will not be able to start up (calls to Start will error) and the Insert and InsertMany functions will be disabled, but the transactional-variants InsertTx and InsertManyTx continue to function. This behavior may be particularly useful in testing so that inserts can be performed and verified on a test transaction that will be rolled back.
func (*Driver) GetExecutor ¶ added in v0.0.13
func (d *Driver) GetExecutor() riverdriver.Executor
func (*Driver) GetListener ¶ added in v0.0.23
func (d *Driver) GetListener() riverdriver.Listener
func (*Driver) GetMigrationLines ¶ added in v0.10.0
func (*Driver) SupportsListener ¶ added in v0.10.0
func (*Driver) UnwrapExecutor ¶ added in v0.0.13
func (d *Driver) UnwrapExecutor(tx pgx.Tx) riverdriver.ExecutorTx
type Executor ¶ added in v0.0.13
type Executor struct {
// contains filtered or unexported fields
}
func (*Executor) Begin ¶ added in v0.0.13
func (e *Executor) Begin(ctx context.Context) (riverdriver.ExecutorTx, error)
func (*Executor) ColumnExists ¶ added in v0.10.0
func (*Executor) JobCancel ¶ added in v0.0.23
func (e *Executor) JobCancel(ctx context.Context, params *riverdriver.JobCancelParams) (*rivertype.JobRow, error)
func (*Executor) JobCountByState ¶ added in v0.1.0
func (*Executor) JobDeleteBefore ¶ added in v0.0.23
func (e *Executor) JobDeleteBefore(ctx context.Context, params *riverdriver.JobDeleteBeforeParams) (int, error)
func (*Executor) JobGetAvailable ¶ added in v0.0.23
func (e *Executor) JobGetAvailable(ctx context.Context, params *riverdriver.JobGetAvailableParams) ([]*rivertype.JobRow, error)
func (*Executor) JobGetByID ¶ added in v0.0.23
func (*Executor) JobGetByIDMany ¶ added in v0.0.23
func (*Executor) JobGetByKindAndUniqueProperties ¶ added in v0.0.23
func (e *Executor) JobGetByKindAndUniqueProperties(ctx context.Context, params *riverdriver.JobGetByKindAndUniquePropertiesParams) (*rivertype.JobRow, error)
func (*Executor) JobGetByKindMany ¶ added in v0.0.23
func (*Executor) JobGetStuck ¶ added in v0.0.23
func (e *Executor) JobGetStuck(ctx context.Context, params *riverdriver.JobGetStuckParams) ([]*rivertype.JobRow, error)
func (*Executor) JobInsertFastMany ¶ added in v0.0.23
func (e *Executor) JobInsertFastMany(ctx context.Context, params []*riverdriver.JobInsertFastParams) ([]*riverdriver.JobInsertFastResult, error)
func (*Executor) JobInsertFastManyNoReturning ¶ added in v0.12.0
func (e *Executor) JobInsertFastManyNoReturning(ctx context.Context, params []*riverdriver.JobInsertFastParams) (int, error)
func (*Executor) JobInsertFull ¶ added in v0.0.23
func (e *Executor) JobInsertFull(ctx context.Context, params *riverdriver.JobInsertFullParams) (*rivertype.JobRow, error)
func (*Executor) JobListFields ¶ added in v0.0.23
func (*Executor) JobRescueMany ¶ added in v0.0.23
func (e *Executor) JobRescueMany(ctx context.Context, params *riverdriver.JobRescueManyParams) (*struct{}, error)
func (*Executor) JobSchedule ¶ added in v0.0.23
func (e *Executor) JobSchedule(ctx context.Context, params *riverdriver.JobScheduleParams) ([]*riverdriver.JobScheduleResult, error)
func (*Executor) JobSetStateIfRunningMany ¶ added in v0.12.1
func (e *Executor) JobSetStateIfRunningMany(ctx context.Context, params *riverdriver.JobSetStateIfRunningManyParams) ([]*rivertype.JobRow, error)
func (*Executor) JobUpdate ¶ added in v0.0.23
func (e *Executor) JobUpdate(ctx context.Context, params *riverdriver.JobUpdateParams) (*rivertype.JobRow, error)
func (*Executor) LeaderAttemptElect ¶ added in v0.0.23
func (e *Executor) LeaderAttemptElect(ctx context.Context, params *riverdriver.LeaderElectParams) (bool, error)
func (*Executor) LeaderAttemptReelect ¶ added in v0.0.23
func (e *Executor) LeaderAttemptReelect(ctx context.Context, params *riverdriver.LeaderElectParams) (bool, error)
func (*Executor) LeaderDeleteExpired ¶ added in v0.0.23
func (*Executor) LeaderGetElectedLeader ¶ added in v0.0.23
func (*Executor) LeaderInsert ¶ added in v0.0.23
func (e *Executor) LeaderInsert(ctx context.Context, params *riverdriver.LeaderInsertParams) (*riverdriver.Leader, error)
func (*Executor) LeaderResign ¶ added in v0.0.23
func (e *Executor) LeaderResign(ctx context.Context, params *riverdriver.LeaderResignParams) (bool, error)
func (*Executor) MigrationDeleteAssumingMainMany ¶ added in v0.10.0
func (*Executor) MigrationDeleteByLineAndVersionMany ¶ added in v0.10.0
func (*Executor) MigrationGetAllAssumingMain ¶ added in v0.10.0
func (*Executor) MigrationGetByLine ¶ added in v0.10.0
func (*Executor) MigrationInsertMany ¶ added in v0.0.13
func (*Executor) MigrationInsertManyAssumingMain ¶ added in v0.10.0
func (*Executor) NotifyMany ¶ added in v0.5.0
func (e *Executor) NotifyMany(ctx context.Context, params *riverdriver.NotifyManyParams) error
func (*Executor) PGAdvisoryXactLock ¶ added in v0.0.23
func (*Executor) QueueCreateOrSetUpdatedAt ¶ added in v0.5.0
func (e *Executor) QueueCreateOrSetUpdatedAt(ctx context.Context, params *riverdriver.QueueCreateOrSetUpdatedAtParams) (*rivertype.Queue, error)
func (*Executor) QueueDeleteExpired ¶ added in v0.5.0
func (e *Executor) QueueDeleteExpired(ctx context.Context, params *riverdriver.QueueDeleteExpiredParams) ([]string, error)
func (*Executor) QueuePause ¶ added in v0.5.0
func (*Executor) QueueResume ¶ added in v0.5.0
type ExecutorTx ¶ added in v0.0.13
type ExecutorTx struct { Executor // contains filtered or unexported fields }
type Listener ¶ added in v0.0.23
type Listener struct {
// contains filtered or unexported fields
}
func (*Listener) WaitForNotification ¶ added in v0.0.23
func (l *Listener) WaitForNotification(ctx context.Context) (*riverdriver.Notification, error)