Documentation ¶ Overview ¶ Package sqltx provides explicit transaction helpers for database/sql. Index ¶ func Do(ctx context.Context, db *sql.DB, opts *sql.TxOptions, fn func(*sql.Tx) error) (err error) Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func Do ¶ func Do(ctx context.Context, db *sql.DB, opts *sql.TxOptions, fn func(*sql.Tx) error) (err error) Do runs fn inside a database transaction. The transaction commits only when fn returns nil. If fn returns an error, Do rolls the transaction back and returns that error. The caller owns db and remains responsible for closing it. Types ¶ This section is empty. Source Files ¶ View all Source files sqltx.go Click to show internal directories. Click to hide internal directories.