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

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

@@ -31,7 +31,7 @@ var (
)
type SqlUserStore struct {
*SqlSupplier
*SqlStore
metrics einterfaces.MetricsInterface
// usersQuery is a starting point for all queries that return one or more Users.
@@ -42,10 +42,10 @@ func (us SqlUserStore) ClearCaches() {}
func (us SqlUserStore) InvalidateProfileCacheForUser(userId string) {}
func newSqlUserStore(sqlSupplier *SqlSupplier, metrics einterfaces.MetricsInterface) store.UserStore {
func newSqlUserStore(sqlStore *SqlStore, metrics einterfaces.MetricsInterface) store.UserStore {
us := &SqlUserStore{
SqlSupplier: sqlSupplier,
metrics: metrics,
SqlStore: sqlStore,
metrics: metrics,
}
// note: we are providing field names explicitly here to maintain order of columns (needed when using raw queries)
@@ -55,7 +55,7 @@ func newSqlUserStore(sqlSupplier *SqlSupplier, metrics einterfaces.MetricsInterf
From("Users u").
LeftJoin("Bots b ON ( b.UserId = u.Id )")
for _, db := range sqlSupplier.GetAllConns() {
for _, db := range sqlStore.GetAllConns() {
table := db.AddTableWithName(model.User{}, "Users").SetKeys(false, "Id")
table.ColMap("Id").SetMaxSize(26)
table.ColMap("Username").SetMaxSize(64).SetUnique(true)