20 lines
532 B
Go
Executable File
20 lines
532 B
Go
Executable File
package mysql
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
// TestRepo exposes a repo implementation for testing purposes
|
|
type TestRepo struct {
|
|
Db *gorm.DB
|
|
}
|
|
|
|
func (t *TestRepo) i() {}
|
|
func (t *TestRepo) GetDbR() *gorm.DB { return t.Db }
|
|
func (t *TestRepo) GetDbW() *gorm.DB { return t.Db }
|
|
func (t *TestRepo) DbRClose() error { return nil }
|
|
func (t *TestRepo) DbWClose() error { return nil }
|
|
|
|
// NewTestRepo creates a new Repo implementation wrapping the given gorm.DB
|
|
func NewTestRepo(db *gorm.DB) Repo {
|
|
return &TestRepo{Db: db}
|
|
}
|