chore: remove sqlstore & mockstore dependencies from (most) packages (#57087)
* chore: add alias for InitTestDB and Session Adds an alias for the sqlstore InitTestDB and Session, and updates tests using these to reduce dependencies on the sqlstore.Store. * next pass of removing sqlstore imports * last little bit * remove mockstore where possible
This commit is contained in:
@@ -4,9 +4,8 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/services/comments/commentmodel"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/db"
|
||||
)
|
||||
|
||||
type sqlStorage struct {
|
||||
@@ -35,7 +34,7 @@ func (s *sqlStorage) Create(ctx context.Context, orgID int64, objectType string,
|
||||
|
||||
var result *commentmodel.Comment
|
||||
|
||||
return result, s.sql.WithTransactionalDbSession(ctx, func(dbSession *sqlstore.DBSession) error {
|
||||
return result, s.sql.WithTransactionalDbSession(ctx, func(dbSession *db.Session) error {
|
||||
var group commentmodel.CommentGroup
|
||||
has, err := dbSession.NoAutoCondition().Where(
|
||||
"org_id=? AND object_type=? AND object_id=?",
|
||||
@@ -97,7 +96,7 @@ func (s *sqlStorage) Get(ctx context.Context, orgID int64, objectType string, ob
|
||||
}
|
||||
}
|
||||
|
||||
return result, s.sql.WithTransactionalDbSession(ctx, func(dbSession *sqlstore.DBSession) error {
|
||||
return result, s.sql.WithTransactionalDbSession(ctx, func(dbSession *db.Session) error {
|
||||
var group commentmodel.CommentGroup
|
||||
has, err := dbSession.NoAutoCondition().Where(
|
||||
"org_id=? AND object_type=? AND object_id=?",
|
||||
|
||||
Reference in New Issue
Block a user