Documentation
¶
Index ¶
- func CreateOrReplace(t testing.TB, u url.URL, dbName string, template string) url.URL
- func NewDB(t testing.TB, dbURL string) *sqlx.DB
- func NewInMemoryDataSource(t *testing.T) sqlutil.DataSource
- func NewNoOpDataSource() sqlutil.DataSource
- func RegisterTxDB(dbURL string) error
- func SkipInMemory(t *testing.T)
- func TestURL(t testing.TB) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateOrReplace ¶ added in v0.5.0
CreateOrReplace creates a new database with the given name (optionally from template), and schedules it to be dropped after test completion.
func NewInMemoryDataSource ¶
func NewInMemoryDataSource(t *testing.T) sqlutil.DataSource
NewInMemoryDataSource returns a new in-memory DataSource
func NewNoOpDataSource ¶
func NewNoOpDataSource() sqlutil.DataSource
NewNoOpDataSource returns an empty DataSource type which will satisfy the interface
func RegisterTxDB ¶ added in v0.5.0
txdb is a simplified version of https://github.com/DATA-DOG/go-txdb
The original lib has various problems and is hard to understand because it tries to be more general. The version in this file is more tightly focused to our needs and should be easier to reason about and less likely to have subtle bugs/races.
It doesn't currently support savepoints but could be made to if necessary.
Transaction BEGIN/ROLLBACK effectively becomes a no-op, this should have no negative impact on normal test operation.
If you MUST test BEGIN/ROLLBACK behaviour, you will have to configure your store to use the raw DialectPostgres dialect and setup a one-use database. See heavyweight.FullTestDB() as a convenience function to help you do this, but please use sparingly because as it's name implies, it is expensive.
func SkipInMemory ¶ added in v0.5.0
SkipInMemory skips the test when using an in-memory database.
Types ¶
This section is empty.