riverpgxv5

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MPL-2.0 Imports: 6 Imported by: 68

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

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

func New(dbPool *pgxpool.Pool) *Driver

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) GetDBPool

func (d *Driver) GetDBPool() *pgxpool.Pool

func (*Driver) GetExecutor added in v0.0.13

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

func (*Driver) UnwrapExecutor added in v0.0.13

func (d *Driver) UnwrapExecutor(tx pgx.Tx) riverdriver.Executor

func (*Driver) UnwrapTx

func (d *Driver) UnwrapTx(tx pgx.Tx) pgx.Tx

type Executor added in v0.0.13

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

func (*Executor) Begin added in v0.0.13

func (*Executor) Exec added in v0.0.13

func (e *Executor) Exec(ctx context.Context, sql string) (struct{}, error)

func (*Executor) MigrationDeleteByVersionMany added in v0.0.13

func (e *Executor) MigrationDeleteByVersionMany(ctx context.Context, versions []int) ([]*riverdriver.Migration, error)

func (*Executor) MigrationGetAll added in v0.0.13

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

func (*Executor) MigrationInsertMany added in v0.0.13

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

func (*Executor) TableExists added in v0.0.13

func (e *Executor) TableExists(ctx context.Context, tableName string) (bool, error)

type ExecutorTx added in v0.0.13

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

func (*ExecutorTx) Commit added in v0.0.13

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

func (*ExecutorTx) Rollback added in v0.0.13

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