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 удалений

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

@@ -42,18 +42,18 @@ func botFromModel(b *model.Bot) *bot {
// Bots are otherwise normal users with extra metadata record in the Bots table. The primary key
// for a bot matches the primary key value for corresponding User record.
type SqlBotStore struct {
*SqlSupplier
*SqlStore
metrics einterfaces.MetricsInterface
}
// newSqlBotStore creates an instance of SqlBotStore, registering the table schema in question.
func newSqlBotStore(sqlSupplier *SqlSupplier, metrics einterfaces.MetricsInterface) store.BotStore {
func newSqlBotStore(sqlStore *SqlStore, metrics einterfaces.MetricsInterface) store.BotStore {
us := &SqlBotStore{
SqlSupplier: sqlSupplier,
metrics: metrics,
SqlStore: sqlStore,
metrics: metrics,
}
for _, db := range sqlSupplier.GetAllConns() {
for _, db := range sqlStore.GetAllConns() {
table := db.AddTableWithName(bot{}, "Bots").SetKeys(false, "UserId")
table.ColMap("UserId").SetMaxSize(26)
table.ColMap("Description").SetMaxSize(1024)