From 8ce81019db8e63a5a539824b5d2a48a14d439b1a Mon Sep 17 00:00:00 2001 From: Selene Date: Wed, 27 Jul 2022 12:58:41 +0200 Subject: [PATCH] Add GetDialect function (#52818) --- pkg/services/sqlstore/mockstore/mockstore.go | 5 +++++ pkg/services/sqlstore/sqlstore.go | 5 +++++ pkg/services/sqlstore/store.go | 2 ++ 3 files changed, 12 insertions(+) diff --git a/pkg/services/sqlstore/mockstore/mockstore.go b/pkg/services/sqlstore/mockstore/mockstore.go index 2754c83740c..90e792de15a 100644 --- a/pkg/services/sqlstore/mockstore/mockstore.go +++ b/pkg/services/sqlstore/mockstore/mockstore.go @@ -5,6 +5,7 @@ import ( "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/services/sqlstore" + "github.com/grafana/grafana/pkg/services/sqlstore/migrator" ) type OrgListResponse []struct { @@ -76,6 +77,10 @@ func (m *SQLStoreMock) GetSystemStats(ctx context.Context, query *models.GetSyst return m.ExpectedError } +func (m *SQLStoreMock) GetDialect() migrator.Dialect { + return nil +} + func (m *SQLStoreMock) DeleteExpiredSnapshots(ctx context.Context, cmd *models.DeleteExpiredSnapshotsCommand) error { return m.ExpectedError } diff --git a/pkg/services/sqlstore/sqlstore.go b/pkg/services/sqlstore/sqlstore.go index 7baa450cb99..8f43d2ce4fa 100644 --- a/pkg/services/sqlstore/sqlstore.go +++ b/pkg/services/sqlstore/sqlstore.go @@ -157,6 +157,11 @@ func (ss *SQLStore) Quote(value string) string { return ss.engine.Quote(value) } +// GetDialect return the dialect +func (ss *SQLStore) GetDialect() migrator.Dialect { + return ss.Dialect +} + func (ss *SQLStore) ensureMainOrgAndAdminUser() error { ctx := context.Background() err := ss.WithTransactionalDbSession(ctx, func(sess *DBSession) error { diff --git a/pkg/services/sqlstore/store.go b/pkg/services/sqlstore/store.go index a7528a3dfb5..e6d97221698 100644 --- a/pkg/services/sqlstore/store.go +++ b/pkg/services/sqlstore/store.go @@ -4,6 +4,7 @@ import ( "context" "github.com/grafana/grafana/pkg/models" + "github.com/grafana/grafana/pkg/services/sqlstore/migrator" ) type Store interface { @@ -11,6 +12,7 @@ type Store interface { GetAlertNotifiersUsageStats(ctx context.Context, query *models.GetAlertNotifierUsageStatsQuery) error GetDataSourceStats(ctx context.Context, query *models.GetDataSourceStatsQuery) error GetDataSourceAccessStats(ctx context.Context, query *models.GetDataSourceAccessStatsQuery) error + GetDialect() migrator.Dialect GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error DeleteExpiredSnapshots(ctx context.Context, cmd *models.DeleteExpiredSnapshotsCommand) error CreateDashboardSnapshot(ctx context.Context, cmd *models.CreateDashboardSnapshotCommand) error