MustExec executes the given SQL query and fails a test if an error occurs
(t *testing.T, message string, db *DB, query string, args ...interface{})
| 45 | |
| 46 | // MustExec executes the given SQL query and fails a test if an error occurs |
| 47 | func MustExec(t *testing.T, message string, db *DB, query string, args ...interface{}) sql.Result { |
| 48 | result, err := db.Exec(query, args...) |
| 49 | if err != nil { |
| 50 | t.Fatal(errors.Wrap(errors.Wrap(err, "executing sql"), message)) |
| 51 | } |
| 52 | |
| 53 | return result |
| 54 | } |
| 55 | |
| 56 | // InitTestMemoryDB initializes an in-memory test database with the default schema. |
| 57 | func InitTestMemoryDB(t *testing.T) *DB { |