Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InTx ¶
InTx starts a database transaction, executes the callback function, and either commits the transaction if the callback exits without an error, or rolls-back the transaction if the callback returns an error.
func InTxContext ¶
func InTxContext(ctx context.Context, db *sql.DB, callback func(tx *sql.Tx) error, opts ...*sql.TxOptions) error
InTxContext starts a context-aware database transaction, executes the callback function, and either commits the transaction if the callback exits without an error, or rolls-back the transaction if the callback returns an error.
Types ¶
type EachRowFunc ¶
EachRowFunc is called to process each query result row.
type PartialQuery ¶
type PartialQuery func(row EachRowFunc) error
PartialQuery is a curried query that passes each result row to EachRowFunc.
func QueryRows ¶
func QueryRows(db *sql.DB, query string, args ...any) PartialQuery
QueryRows provides the entry point to retrieve a number of rows from a given query and arguments, using database/sql/#DB.QueryRow as inspiration.
func QueryRowsContext ¶
QueryRowsContext provides the entry point to retrieve a number of rows from a given query and arguments, using database/sql/#DB.QueryRowContext as inspiration.