mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* SQLStore: Ensure that sessions are always closed Delete `NewSession()` in favour of `WithDbSession()` * Add WithDbSessionForceNewSession to the interface * Apply suggestions from code review
28 lines
572 B
Go
28 lines
572 B
Go
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
|
|
}
|
|
|
|
func (f *FakeDB) WithNewDbSession(ctx context.Context, callback sqlstore.DBTransactionFunc) error {
|
|
return f.ExpectedError
|
|
}
|