Removing supplier concept from the sql store (#16355)

* Removing supplier concept from the sql store

* Removing other metions to supplier

* Fixing gofmt

* Fixing gofmt

* Renaming NewSqlStore to New

* Fixing tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Jesús Espino
2020-12-02 12:06:23 +01:00
коммит произвёл GitHub
родитель 11248831b8
Коммит a74fe05695
76 изменённых файлов: 2559 добавлений и 2578 удалений

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

@@ -25,7 +25,7 @@ type MainHelper struct {
Settings *model.SqlSettings
Store store.Store
SearchEngine *searchengine.Broker
SQLSupplier *sqlstore.SqlSupplier
SQLStore *sqlstore.SqlStore
ClusterInterface *FakeClusterInterface
status int
@@ -109,9 +109,9 @@ func (h *MainHelper) setupStore() {
h.SearchEngine = searchengine.NewBroker(config, nil)
h.ClusterInterface = &FakeClusterInterface{}
h.SQLSupplier = sqlstore.NewSqlSupplier(*h.Settings, nil)
h.SQLStore = sqlstore.New(*h.Settings, nil)
h.Store = searchlayer.NewSearchLayer(&TestStore{
h.SQLSupplier,
h.SQLStore,
}, h.SearchEngine, config)
}
@@ -151,7 +151,7 @@ func (h *MainHelper) PreloadMigrations() {
panic(fmt.Errorf("cannot read file: %v", err))
}
}
handle := h.SQLSupplier.GetMaster()
handle := h.SQLStore.GetMaster()
_, err = handle.Exec(string(buf))
if err != nil {
mlog.Error("Error preloading migrations. Check if you have &multiStatements=true in your DSN if you are using MySQL. Or perhaps the schema changed? If yes, then update the warmup files accordingly.")
@@ -160,8 +160,8 @@ func (h *MainHelper) PreloadMigrations() {
}
func (h *MainHelper) Close() error {
if h.SQLSupplier != nil {
h.SQLSupplier.Close()
if h.SQLStore != nil {
h.SQLStore.Close()
}
if h.Settings != nil {
storetest.CleanupSqlSettings(h.Settings)
@@ -195,12 +195,12 @@ func (h *MainHelper) GetStore() store.Store {
return h.Store
}
func (h *MainHelper) GetSQLSupplier() *sqlstore.SqlSupplier {
if h.SQLSupplier == nil {
panic("MainHelper not initialized with sql supplier.")
func (h *MainHelper) GetSQLStore() *sqlstore.SqlStore {
if h.SQLStore == nil {
panic("MainHelper not initialized with sql store.")
}
return h.SQLSupplier
return h.SQLStore
}
func (h *MainHelper) GetClusterInterface() *FakeClusterInterface {