Documentation
¶
Index ¶
- func MustExec(t *testing.T, ds sqlutil.DataSource, stmt string, args ...interface{})
- func NewIndependentSqlxDB(t testing.TB) *sqlx.DB
- func NewIndependentSqlxDBs(t testing.TB, n int) []*sqlx.DB
- func NewIndependentSqlxSessions(t testing.TB, n int) []*sqlx.DB
- func NewSqlxDB(t testing.TB) *sqlx.DB
- func SkipShortDB(tb testing.TB)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustExec ¶
func MustExec(t *testing.T, ds sqlutil.DataSource, stmt string, args ...interface{})
func NewIndependentSqlxDB ¶
NewIndependentSqlxDB return a new independent test database, which does not use txdb and therefore supports txs etc. Use this with caution, as it is much more costly than NewSqlxDB.
func NewIndependentSqlxDBs ¶ added in v1.1.3
NewIndependentSqlxDBs returns n handles to a single fresh test database, which does not use txdb and therefore supports real transactions and lock contention between connections. Use this with caution, as it is much more costly than NewSqlxDB.
func NewIndependentSqlxSessions ¶ added in v1.1.3
NewIndependentSqlxSessions returns n handles to a single fresh test database, each pinned to its own connection (pool size 1). Unlike the handles from NewIndependentSqlxDBs, session state such as SET or an open transaction does not leak between them, which makes it suitable for tests that hold locks on one session while another session contends for them.
lock_timeout is set so that a regression that makes a query wait on a lock fails the test instead of hanging it.
func SkipShortDB ¶
SkipShortDB skips tb during -short runs, and notes the DB dependency.
Types ¶
This section is empty.