db

package
v0.1.50 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure added in v0.0.23

func Configure(sqlDB *sql.DB) (*gorm.DB, error)

func Connect

func Connect() (*sql.DB, error)

func ConnectAndConfigureFromTest added in v0.0.23

func ConnectAndConfigureFromTest(t *testing.T) *gorm.DB

ConnectAndConfigureFromTest is like Connect and Configure but accepts a testing.T in exchange for never returning an error--the test will be failed instead if there is one.

func Truncate added in v0.0.23

func Truncate(t *testing.T, db *gorm.DB)

Truncate cleans up tables, intended for usage with functional tests. It will refuse to run if not given a testing.T or if Sherlock's current mode is anything other than 'debug'.

As an implementation note, the SQL this function runs is fairly consistent, but as Jack discovered, it is surprisingly annoying to debug, because it requires specific ordering, must be run manually, and (with the addition of v2 models) has effectively variable table names. This function handles and documents that complexity so we don't need to rediscover it each time we make a database change.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL