protopgx

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package protopgx includes wrapper logic to make a pgx connection type implement protoql.Store for use in generated code.

In init(), we will alter pgx.ErrNoRows to wrap (database/sql).ErrNoRows, and then update protoql.ErrNoRows to wrap that. This ensures that errors.Is(someErr, ErrNoRows) will always work as expected, regardless of whether the caller is checking pgx.ErrNoRows, sql.ErrNoRows, or protoql.ErrNoRows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(conn PGXConn) protoql.Store[pgx.TxOptions]

Types

type PGXConn

type PGXConn interface {
	PGXQuerier
	BeginTx(context.Context, pgx.TxOptions) (pgx.Tx, error)
}

type PGXQuerier

type PGXQuerier interface {
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
}

Jump to

Keyboard shortcuts

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