mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 15:44:21 +00:00
31 lines
457 B
Go
31 lines
457 B
Go
//go:build test
|
|
|
|
package db
|
|
|
|
import (
|
|
"database/sql"
|
|
"novamd/internal/secrets"
|
|
)
|
|
|
|
type TestDatabase interface {
|
|
Database
|
|
TestDB() *sql.DB
|
|
}
|
|
|
|
func NewTestDB(dbPath string, secretsService secrets.Service) (TestDatabase, error) {
|
|
db, err := Init(dbPath, secretsService)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &testDatabase{db.(*database)}, nil
|
|
}
|
|
|
|
type testDatabase struct {
|
|
*database
|
|
}
|
|
|
|
func (td *testDatabase) TestDB() *sql.DB {
|
|
return td.DB
|
|
}
|