Documentation ¶
Index ¶
- func AssertNoErr(t *testing.T, err error)
- func AutoMigrate(db *gorm.DB, givenTables ...interface{})
- func GetTestDB() *gorm.DB
- func PrepareDBAndTables(tables ...interface{}) *gorm.DB
- func ResetDBTables(db *gorm.DB, tables ...interface{})
- func TestDB() *gorm.DB
- func Truncate(db *gorm.DB, givenTables ...interface{})
- type Migratable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoErr ¶
AssertNoErr makes current test case fatal if it receives a non-nil error
func AutoMigrate ¶
AutoMigrate receives table arguments and create or update their table structure in database.
func PrepareDBAndTables ¶
PrepareDBAndTables prepare given tables cleanly and return a test database instance
func ResetDBTables ¶
ResetDBTables reset given tables.
Types ¶
type Migratable ¶
Migratable defines interface for implementing post-migration actions such as adding constraints that arent's supported by Gorm's struct tags. This function must be idempotent, since it will most likely be executed multiple times.
Click to show internal directories.
Click to hide internal directories.