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.
- type Driver
- func (d *Driver) ArgPlaceholder() string
- func (d *Driver) DatabaseName() string
- func (d *Driver) GetExecutor() riverdriver.Executor
- func (d *Driver) GetListener(params *riverdriver.GetListenenerParams) riverdriver.Listener
- func (d *Driver) GetMigrationDefaultLines() []string
- func (d *Driver) GetMigrationFS(line string) fs.FS
- func (d *Driver) GetMigrationLines() []string
- func (d *Driver) GetMigrationTruncateTables(line string, version int) []string
- func (d *Driver) PoolIsSet() bool
- func (d *Driver) PoolSet(dbPool any) error
- func (d *Driver) SQLFragmentColumnContainsAll(column, namedArg string, values []string) (string, any, error)
- func (d *Driver) SQLFragmentColumnContainsAny(column, namedArg string, values []string) (string, any, error)
- func (d *Driver) SQLFragmentColumnIn(column string, values any) (string, any, error)
- func (d *Driver) SupportsListenNotify() bool
- func (d *Driver) SupportsListener() bool
- func (d *Driver) TimePrecision() time.Duration
- func (d *Driver) UnwrapExecutor(tx pgx.Tx) riverdriver.ExecutorTx
- func (d *Driver) UnwrapTx(execTx riverdriver.ExecutorTx) pgx.Tx
- type Executor
- func (e *Executor) Begin(ctx context.Context) (riverdriver.ExecutorTx, error)
- func (e *Executor) ColumnExists(ctx context.Context, params *riverdriver.ColumnExistsParams) (bool, error)
- func (e *Executor) Exec(ctx context.Context, sql string, args ...any) error
- func (e *Executor) IndexDropIfExists(ctx context.Context, params *riverdriver.IndexDropIfExistsParams) error
- func (e *Executor) IndexExists(ctx context.Context, params *riverdriver.IndexExistsParams) (bool, error)
- func (e *Executor) IndexReindex(ctx context.Context, params *riverdriver.IndexReindexParams) error
- func (e *Executor) IndexReindexArtifacts(ctx context.Context, params *riverdriver.IndexReindexArtifactsParams) ([]string, error)
- func (e *Executor) IndexesExist(ctx context.Context, params *riverdriver.IndexesExistParams) (map[string]bool, error)
- func (e *Executor) JobCancel(ctx context.Context, params *riverdriver.JobCancelParams) (*rivertype.JobRow, error)
- func (e *Executor) JobCountByAllStates(ctx context.Context, params *riverdriver.JobCountByAllStatesParams) (map[rivertype.JobState]int, error)
- func (e *Executor) JobCountByQueueAndState(ctx context.Context, params *riverdriver.JobCountByQueueAndStateParams) ([]*riverdriver.JobCountByQueueAndStateResult, error)
- func (e *Executor) JobCountByState(ctx context.Context, params *riverdriver.JobCountByStateParams) (int, error)
- func (e *Executor) JobDelete(ctx context.Context, params *riverdriver.JobDeleteParams) (*rivertype.JobRow, error)
- func (e *Executor) JobDeleteBefore(ctx context.Context, params *riverdriver.JobDeleteBeforeParams) (int, error)
- func (e *Executor) JobDeleteMany(ctx context.Context, params *riverdriver.JobDeleteManyParams) ([]*rivertype.JobRow, error)
- func (e *Executor) JobGetAvailable(ctx context.Context, params *riverdriver.JobGetAvailableParams) ([]*rivertype.JobRow, error)
- func (e *Executor) JobGetByID(ctx context.Context, params *riverdriver.JobGetByIDParams) (*rivertype.JobRow, error)
- func (e *Executor) JobGetByIDMany(ctx context.Context, params *riverdriver.JobGetByIDManyParams) ([]*rivertype.JobRow, error)
- func (e *Executor) JobGetByKindMany(ctx context.Context, params *riverdriver.JobGetByKindManyParams) ([]*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.JobInsertFastManyParams) ([]*riverdriver.JobInsertFastResult, error)
- func (e *Executor) JobInsertFastManyNoReturning(ctx context.Context, params *riverdriver.JobInsertFastManyParams) (int, error)
- func (e *Executor) JobInsertFull(ctx context.Context, params *riverdriver.JobInsertFullParams) (*rivertype.JobRow, error)
- func (e *Executor) JobInsertFullMany(ctx context.Context, params *riverdriver.JobInsertFullManyParams) ([]*rivertype.JobRow, error)
- func (e *Executor) JobKindList(ctx context.Context, params *riverdriver.JobKindListParams) ([]string, error)
- func (e *Executor) JobList(ctx context.Context, params *riverdriver.JobListParams) ([]*rivertype.JobRow, error)
- func (e *Executor) JobRescueMany(ctx context.Context, params *riverdriver.JobRescueManyParams) (*struct{}, error)
- func (e *Executor) JobRetry(ctx context.Context, params *riverdriver.JobRetryParams) (*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) JobUpdateFull(ctx context.Context, params *riverdriver.JobUpdateFullParams) (*rivertype.JobRow, error)
- func (e *Executor) LeaderAttemptElect(ctx context.Context, params *riverdriver.LeaderElectParams) (*riverdriver.Leader, error)
- func (e *Executor) LeaderAttemptReelect(ctx context.Context, params *riverdriver.LeaderReelectParams) (*riverdriver.Leader, error)
- func (e *Executor) LeaderDeleteExpired(ctx context.Context, params *riverdriver.LeaderDeleteExpiredParams) (int, error)
- func (e *Executor) LeaderGetElectedLeader(ctx context.Context, params *riverdriver.LeaderGetElectedLeaderParams) (*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, params *riverdriver.MigrationDeleteAssumingMainManyParams) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationDeleteByLineAndVersionMany(ctx context.Context, ...) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationGetAllAssumingMain(ctx context.Context, params *riverdriver.MigrationGetAllAssumingMainParams) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationGetByLine(ctx context.Context, params *riverdriver.MigrationGetByLineParams) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationInsertMany(ctx context.Context, params *riverdriver.MigrationInsertManyParams) ([]*riverdriver.Migration, error)
- func (e *Executor) MigrationInsertManyAssumingMain(ctx context.Context, params *riverdriver.MigrationInsertManyAssumingMainParams) ([]*riverdriver.Migration, error)
- func (e *Executor) NotificationDeleteBefore(ctx context.Context, params *riverdriver.NotificationDeleteBeforeParams) (int, 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) QueryRow(ctx context.Context, sql string, args ...any) riverdriver.Row
- 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, params *riverdriver.QueueGetParams) (*rivertype.Queue, error)
- func (e *Executor) QueueList(ctx context.Context, params *riverdriver.QueueListParams) ([]*rivertype.Queue, error)
- func (e *Executor) QueueNameList(ctx context.Context, params *riverdriver.QueueNameListParams) ([]string, error)
- func (e *Executor) QueuePause(ctx context.Context, params *riverdriver.QueuePauseParams) error
- func (e *Executor) QueueResume(ctx context.Context, params *riverdriver.QueueResumeParams) error
- func (e *Executor) QueueUpdate(ctx context.Context, params *riverdriver.QueueUpdateParams) (*rivertype.Queue, error)
- func (e *Executor) SchemaCreate(ctx context.Context, params *riverdriver.SchemaCreateParams) error
- func (e *Executor) SchemaDrop(ctx context.Context, params *riverdriver.SchemaDropParams) error
- func (e *Executor) SchemaGetExpired(ctx context.Context, params *riverdriver.SchemaGetExpiredParams) ([]string, error)
- func (e *Executor) TableExists(ctx context.Context, params *riverdriver.TableExistsParams) (bool, error)
- func (e *Executor) TableTruncate(ctx context.Context, params *riverdriver.TableTruncateParams) 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) Schema() string
- func (l *Listener) SetAfterConnectExec(sql string)
- func (l *Listener) Unlisten(ctx context.Context, topic string) error
- func (l *Listener) WaitForNotification(ctx context.Context) (*riverdriver.Notification, error)
This section is empty.
This section is empty.
This section is empty.
type Driver struct {
}
Driver is an implementation of riverdriver.Driver for Pgx v5.
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.
type Executor struct {
}
type ExecutorTx struct {
Executor
}