constructpgx

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertRowsAffected

func AssertRowsAffected(operation string, expectedRows int) func(pgconn.CommandTag) error

AssertRowsAffected returns a func that checks if the given operation result affected exactly the expected number of rows.

func CollectRows

func CollectRows[T any](rows pgx.Rows, err error) ([]T, error)

CollectRows collects all rows to the given target type from a ExecutiveQueryBuilder.Query result. It is based on pgx.CollectRows but accepts an additional error for easier use.

func IterateRows added in v2.2.0

func IterateRows[T any](rows pgx.Rows, err error) iter.Seq2[T, error]

IterateRows returns an iterator over the rows of a database query and scans them to T. If an error occurred initially, while scanning or closing, it returns a single-use iterator with the error. It returns a single-use iterator.

func ScanRow

func ScanRow[T any](row pgx.Row, err error) (T, error)

ScanRow scans a single row to the given target type from a ExecutiveQueryBuilder.QueryRow result.

Types

This section is empty.

Jump to

Keyboard shortcuts

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