mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add fakes for db interface (#46885)
This commit is contained in:
23
pkg/services/sqlstore/db/dbtest/dbtest.go
Normal file
23
pkg/services/sqlstore/db/dbtest/dbtest.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package dbtest
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
)
|
||||
|
||||
type FakeDB struct {
|
||||
ExpectedError error
|
||||
}
|
||||
|
||||
func NewFakeDB() *FakeDB {
|
||||
return &FakeDB{}
|
||||
}
|
||||
|
||||
func (f *FakeDB) WithTransactionalDbSession(ctx context.Context, callback sqlstore.DBTransactionFunc) error {
|
||||
return f.ExpectedError
|
||||
}
|
||||
|
||||
func (f *FakeDB) WithDbSession(ctx context.Context, callback sqlstore.DBTransactionFunc) error {
|
||||
return f.ExpectedError
|
||||
}
|
||||
Reference in New Issue
Block a user