[MM-44329] Add a method to store.Store interface to get sql.DB object (#20351)

* [MM-44329] Added methods to sqlstore.Store

* [MM-44329] Added methods to the store.Store interface

* [MM-44329] Regenerated mocks

* [MM-44329] Added comments for the store.Store interface

Co-authored-by: Tim Scheuermann <tim.scheuermann@mattermost.com>
Этот коммит содержится в:
Tim Scheuermann
2022-06-03 11:11:23 +02:00
коммит произвёл GitHub
родитель 8f912b697e
Коммит f836826c1d
4 изменённых файлов: 73 добавлений и 8 удалений

Просмотреть файл

@@ -10,6 +10,8 @@ import (
model "github.com/mattermost/mattermost-server/v6/model"
mock "github.com/stretchr/testify/mock"
sql "database/sql"
store "github.com/mattermost/mattermost-server/v6/store"
time "time"
@@ -287,6 +289,38 @@ func (_m *Store) GetDbVersion(numerical bool) (string, error) {
return r0, r1
}
// GetInternalMasterDB provides a mock function with given fields:
func (_m *Store) GetInternalMasterDB() *sql.DB {
ret := _m.Called()
var r0 *sql.DB
if rf, ok := ret.Get(0).(func() *sql.DB); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*sql.DB)
}
}
return r0
}
// GetInternalReplicaDBs provides a mock function with given fields:
func (_m *Store) GetInternalReplicaDBs() []*sql.DB {
ret := _m.Called()
var r0 []*sql.DB
if rf, ok := ret.Get(0).(func() []*sql.DB); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*sql.DB)
}
}
return r0
}
// Group provides a mock function with given fields:
func (_m *Store) Group() store.GroupStore {
ret := _m.Called()

Просмотреть файл

@@ -5,6 +5,7 @@ package storetest
import (
"context"
"database/sql"
"time"
"github.com/stretchr/testify/mock"
@@ -103,6 +104,8 @@ func (s *Store) LockToMaster() { /* do nothing */ }
func (s *Store) UnlockFromMaster() { /* do nothing */ }
func (s *Store) DropAllTables() { /* do nothing */ }
func (s *Store) GetDbVersion(bool) (string, error) { return "", nil }
func (s *Store) GetInternalMasterDB() *sql.DB { return nil }
func (s *Store) GetInternalReplicaDBs() []*sql.DB { return nil }
func (s *Store) RecycleDBConnections(time.Duration) {}
func (s *Store) GetDBSchemaVersion() (int, error) { return 1, nil }
func (s *Store) GetAppliedMigrations() ([]model.AppliedMigration, error) {