Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIndexedTx ¶
GetIndexedTx works like GetTx, except that it provides the option to specify which database to get a transaction from.
func GetRawDB ¶
GetRawDB returns the raw database from the provided context, or nil if it does not exist. Prefer GetTx when you can.
func GetTx ¶
GetTx returns a transaction for the provided context. Successive calls will return the same transaction, unless the transaction initialisation failed.
func WithDB ¶
func WithDB(params WrapParams) mw.Middleware
WithDB returns a middleware which provides the context with a transaction and a database.
Types ¶
type WrapParams ¶
type WrapParams struct { // DB is the database to connect to. Has to be nonnil. DB *sqlx.DB // Options when starting a transactional DBOpts *sql.TxOptions // Index is the index of this database. This argument is optional and is not // necessary unless you need to connect to multiple different SQL databases. Index int // contains filtered or unexported fields }
WrapParams is the set of input parameters
Click to show internal directories.
Click to hide internal directories.