query

package
v0.0.0-pre.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRetriableError

func IsRetriableError(err error) bool

IsRetriableError returns true if the given error might be transient and the interaction can be safely retried.

func Retry

func Retry(ctx context.Context, f func(ctx context.Context) error) error

Retry wraps a function that interacts with the database, and retries it in case a transient error is hit.

This should by typically used to wrap transactions.

func SelectIntegers

func SelectIntegers(ctx context.Context, tx *sql.Tx, query string, args ...any) ([]int, error)

SelectIntegers executes a statement which must yield rows with a single integer column. It returns the list of column values.

func Transaction

func Transaction(ctx context.Context, db *sql.DB, f func(context.Context, *sql.Tx) error) error

Transaction executes the given function within a database transaction with a 30s context timeout.

Types

This section is empty.

Jump to

Keyboard shortcuts

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