riverdatabasesql

package module
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: MPL-2.0 Imports: 19 Imported by: 5

Documentation

Overview

Package riverdatabasesql bundles a River driver for Go's built-in database/sql, making it interoperable with ORMs like Bun and GORM. It's generally still powered under the hood by Pgx because it's the only maintained, fully functional Postgres driver in the Go ecosystem, but it uses some lib/pq constructs internally by virtue of being implemented with Sqlc.

Index

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 database/sql.

func New

func New(dbPool *sql.DB) *Driver

New returns a new database/sql River driver for use with River.

It takes an sql.DB 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.

func (*Driver) ArgPlaceholder added in v0.23.0

func (d *Driver) ArgPlaceholder() string

func (*Driver) DatabaseName added in v0.23.0

func (d *Driver) DatabaseName() string

func (*Driver) GetExecutor

func (d *Driver) GetExecutor() riverdriver.Executor

func (*Driver) GetListener added in v0.0.23

func (d *Driver) GetListener(params *riverdriver.GetListenenerParams) riverdriver.Listener

func (*Driver) GetMigrationDefaultLines added in v0.21.0

func (d *Driver) GetMigrationDefaultLines() []string

func (*Driver) GetMigrationFS added in v0.10.0

func (d *Driver) GetMigrationFS(line string) fs.FS

func (*Driver) GetMigrationLines added in v0.10.0

func (d *Driver) GetMigrationLines() []string

func (*Driver) GetMigrationTruncateTables added in v0.21.0

func (d *Driver) GetMigrationTruncateTables(line string, version int) []string

func (*Driver) PoolIsSet added in v0.23.0

func (d *Driver) PoolIsSet() bool

func (*Driver) PoolSet added in v0.23.0

func (d *Driver) PoolSet(dbPool any) error

func (*Driver) SQLFragmentColumnIn added in v0.23.0

func (d *Driver) SQLFragmentColumnIn(column string, values any) (string, any, error)

func (*Driver) SupportsListenNotify added in v0.23.0

func (d *Driver) SupportsListenNotify() bool

func (*Driver) SupportsListener added in v0.10.0

func (d *Driver) SupportsListener() bool

func (*Driver) TimePrecision added in v0.23.0

func (d *Driver) TimePrecision() time.Duration

func (*Driver) UnwrapExecutor

func (d *Driver) UnwrapExecutor(tx *sql.Tx) riverdriver.ExecutorTx

func (*Driver) UnwrapTx

func (d *Driver) UnwrapTx(execTx riverdriver.ExecutorTx) *sql.Tx

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func (*Executor) Begin

func (*Executor) ColumnExists added in v0.10.0

func (e *Executor) ColumnExists(ctx context.Context, params *riverdriver.ColumnExistsParams) (bool, error)

func (*Executor) Exec

func (e *Executor) Exec(ctx context.Context, sql string, args ...any) error

func (*Executor) IndexDropIfExists added in v0.23.0

func (e *Executor) IndexDropIfExists(ctx context.Context, params *riverdriver.IndexDropIfExistsParams) error

func (*Executor) IndexExists added in v0.23.0

func (e *Executor) IndexExists(ctx context.Context, params *riverdriver.IndexExistsParams) (bool, error)

func (*Executor) IndexReindex added in v0.23.0

func (e *Executor) IndexReindex(ctx context.Context, params *riverdriver.IndexReindexParams) error

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 (e *Executor) JobCountByState(ctx context.Context, params *riverdriver.JobCountByStateParams) (int, error)

func (*Executor) JobDelete added in v0.7.0

func (e *Executor) JobDelete(ctx context.Context, params *riverdriver.JobDeleteParams) (*rivertype.JobRow, error)

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 (e *Executor) JobGetByID(ctx context.Context, params *riverdriver.JobGetByIDParams) (*rivertype.JobRow, error)

func (*Executor) JobGetByIDMany added in v0.0.23

func (e *Executor) JobGetByIDMany(ctx context.Context, params *riverdriver.JobGetByIDManyParams) ([]*rivertype.JobRow, error)

func (*Executor) JobGetByKindMany added in v0.0.23

func (e *Executor) JobGetByKindMany(ctx context.Context, params *riverdriver.JobGetByKindManyParams) ([]*rivertype.JobRow, error)

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 (*Executor) JobInsertFastManyNoReturning added in v0.12.0

func (e *Executor) JobInsertFastManyNoReturning(ctx context.Context, params *riverdriver.JobInsertFastManyParams) (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) JobInsertFullMany added in v0.23.0

func (e *Executor) JobInsertFullMany(ctx context.Context, params *riverdriver.JobInsertFullManyParams) ([]*rivertype.JobRow, error)

func (*Executor) JobList added in v0.0.23

func (e *Executor) JobList(ctx context.Context, params *riverdriver.JobListParams) ([]*rivertype.JobRow, error)

func (*Executor) JobRescueMany added in v0.0.23

func (e *Executor) JobRescueMany(ctx context.Context, params *riverdriver.JobRescueManyParams) (*struct{}, error)

func (*Executor) JobRetry added in v0.0.23

func (e *Executor) JobRetry(ctx context.Context, params *riverdriver.JobRetryParams) (*rivertype.JobRow, error)

func (*Executor) JobSchedule added in v0.0.23

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 (e *Executor) LeaderDeleteExpired(ctx context.Context, params *riverdriver.LeaderDeleteExpiredParams) (int, error)

func (*Executor) LeaderGetElectedLeader added in v0.0.23

func (e *Executor) LeaderGetElectedLeader(ctx context.Context, params *riverdriver.LeaderGetElectedLeaderParams) (*riverdriver.Leader, error)

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 (e *Executor) MigrationDeleteAssumingMainMany(ctx context.Context, params *riverdriver.MigrationDeleteAssumingMainManyParams) ([]*riverdriver.Migration, error)

func (*Executor) MigrationDeleteByLineAndVersionMany added in v0.10.0

func (e *Executor) MigrationDeleteByLineAndVersionMany(ctx context.Context, params *riverdriver.MigrationDeleteByLineAndVersionManyParams) ([]*riverdriver.Migration, error)

func (*Executor) MigrationGetAllAssumingMain added in v0.10.0

func (e *Executor) MigrationGetAllAssumingMain(ctx context.Context, params *riverdriver.MigrationGetAllAssumingMainParams) ([]*riverdriver.Migration, error)

func (*Executor) MigrationGetByLine added in v0.10.0

func (e *Executor) MigrationGetByLine(ctx context.Context, params *riverdriver.MigrationGetByLineParams) ([]*riverdriver.Migration, error)

func (*Executor) MigrationInsertMany

func (e *Executor) MigrationInsertMany(ctx context.Context, params *riverdriver.MigrationInsertManyParams) ([]*riverdriver.Migration, error)

func (*Executor) MigrationInsertManyAssumingMain added in v0.10.0

func (e *Executor) MigrationInsertManyAssumingMain(ctx context.Context, params *riverdriver.MigrationInsertManyAssumingMainParams) ([]*riverdriver.Migration, error)

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 (e *Executor) PGAdvisoryXactLock(ctx context.Context, key int64) (*struct{}, error)

func (*Executor) QueryRow added in v0.21.0

func (e *Executor) QueryRow(ctx context.Context, sql string, args ...any) riverdriver.Row

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) QueueGet added in v0.5.0

func (e *Executor) QueueGet(ctx context.Context, params *riverdriver.QueueGetParams) (*rivertype.Queue, error)

func (*Executor) QueueList added in v0.5.0

func (e *Executor) QueueList(ctx context.Context, params *riverdriver.QueueListParams) ([]*rivertype.Queue, error)

func (*Executor) QueuePause added in v0.5.0

func (e *Executor) QueuePause(ctx context.Context, params *riverdriver.QueuePauseParams) error

func (*Executor) QueueResume added in v0.5.0

func (e *Executor) QueueResume(ctx context.Context, params *riverdriver.QueueResumeParams) error

func (*Executor) QueueUpdate added in v0.20.0

func (e *Executor) QueueUpdate(ctx context.Context, params *riverdriver.QueueUpdateParams) (*rivertype.Queue, error)

func (*Executor) SchemaCreate added in v0.23.0

func (e *Executor) SchemaCreate(ctx context.Context, params *riverdriver.SchemaCreateParams) error

func (*Executor) SchemaDrop added in v0.23.0

func (e *Executor) SchemaDrop(ctx context.Context, params *riverdriver.SchemaDropParams) error

func (*Executor) SchemaGetExpired added in v0.21.0

func (e *Executor) SchemaGetExpired(ctx context.Context, params *riverdriver.SchemaGetExpiredParams) ([]string, error)

func (*Executor) TableExists

func (e *Executor) TableExists(ctx context.Context, params *riverdriver.TableExistsParams) (bool, error)

func (*Executor) TableTruncate added in v0.23.0

func (e *Executor) TableTruncate(ctx context.Context, params *riverdriver.TableTruncateParams) error

type ExecutorSubTx added in v0.10.0

type ExecutorSubTx struct {
	Executor
	// contains filtered or unexported fields
}

func (*ExecutorSubTx) Begin added in v0.10.0

func (*ExecutorSubTx) Commit added in v0.10.0

func (t *ExecutorSubTx) Commit(ctx context.Context) error

func (*ExecutorSubTx) Rollback added in v0.10.0

func (t *ExecutorSubTx) Rollback(ctx context.Context) error

type ExecutorTx

type ExecutorTx struct {
	Executor
	// contains filtered or unexported fields
}

func (*ExecutorTx) Begin added in v0.10.0

func (*ExecutorTx) Commit

func (t *ExecutorTx) Commit(ctx context.Context) error

func (*ExecutorTx) Rollback

func (t *ExecutorTx) Rollback(ctx context.Context) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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