Kill gorp (#19786)
* Kill gorp Gorp is dead. Long live Gorp. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c3ec0a145b
Коммит
4da98cb51a
@@ -32,13 +32,10 @@ func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model
|
||||
settings := p.API.GetUnsanitizedConfig().SqlSettings
|
||||
settings.Trace = model.NewBool(false)
|
||||
store := sqlstore.New(settings, nil)
|
||||
store.GetMaster().Db.Close()
|
||||
store.GetMasterX().Close()
|
||||
|
||||
for _, isMaster := range []bool{true, false} {
|
||||
// We replace the master DB with master and replica both just to make
|
||||
// gorp APIs work.
|
||||
handle := sql.OpenDB(driver.NewConnector(p.Driver, isMaster))
|
||||
store.GetMaster().Db = handle
|
||||
store.SetMasterX(handle)
|
||||
|
||||
wrapper := sqlstore.NewStoreTestWrapper(store)
|
||||
@@ -49,7 +46,7 @@ func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model
|
||||
storetest.TestChannelStore(p.t, store, wrapper)
|
||||
storetest.TestBotStore(p.t, store, wrapper)
|
||||
|
||||
store.GetMaster().Db.Close()
|
||||
store.GetMasterX().Close()
|
||||
}
|
||||
|
||||
// Use the API to instantiate the driver
|
||||
|
||||
Ссылка в новой задаче
Block a user