client

package
v0.0.0-...-c4f087e Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMigrationVersion

func CheckMigrationVersion(ctx context.Context, connectionString string, expectedMigration int64) error

CheckMigrationVersion refuses a database older than the caller requires, or one whose River migrations are not current.

It only reads. The version comes from an explicit store rather than goose's package-level version API, for two reasons. That API's read path creates the tracking table when it is missing — a write, on exactly the unmigrated database this check exists to turn away, and one a service's own database role may not be granted. And it selects the table through a global that any goroutine may rewrite, which the race detector reports as soon as two callers overlap.

Types

type Client

type Client struct {
	*database.Queries
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, databaseURL string, options ...pool.Option) (*Client, error)

func NewReadClient

func NewReadClient(ctx context.Context, databaseURL string, options ...pool.Option) (*Client, error)

NewReadClient is NewClient for a read replica. Its pool metrics carry pool.name "read" so they stay apart from the primary's.

func (*Client) Close

func (db *Client) Close() error

func (*Client) Pool

func (db *Client) Pool() *pgxpool.Pool

Pool exposes the underlying pgx pool for the River outbox client.

func (*Client) TestsRawSQL

func (db *Client) TestsRawSQL(ctx context.Context, sql string, args ...any) error

func (*Client) TestsRawSQLQuery

func (db *Client) TestsRawSQLQuery(ctx context.Context, sql string, processRows func(pgx.Rows) error, args ...any) error

func (*Client) WithTx

func (db *Client) WithTx(ctx context.Context) (*Client, pgx.Tx, error)

WithTx starts a read-write transaction and returns a transactional Client.

Jump to

Keyboard shortcuts

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