MM-23646: Improve group sync performance. (#14171)

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Martin Kraft
2020-04-21 15:55:30 -04:00
коммит произвёл GitHub
родитель d9713792ba
Коммит 70e9647e85
6 изменённых файлов: 79 добавлений и 0 удалений

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

@@ -966,6 +966,24 @@ func (us SqlUserStore) GetAllUsingAuthService(authService string) ([]*model.User
return users, nil
}
func (us SqlUserStore) GetAllNotInAuthService(authServices []string) ([]*model.User, *model.AppError) {
query := us.usersQuery.
Where(sq.NotEq{"u.AuthService": authServices}).
OrderBy("u.Username ASC")
queryString, args, err := query.ToSql()
if err != nil {
return nil, model.NewAppError("SqlUserStore.GetAllNotInAuthService", "store.sql_user.app_error", nil, err.Error(), http.StatusInternalServerError)
}
var users []*model.User
if _, err := us.GetReplica().Select(&users, queryString, args...); err != nil {
return nil, model.NewAppError("SqlUserStore.GetAllUsingAuthService", "store.sql_user.get_by_auth.other.app_error", nil, "", http.StatusInternalServerError)
}
return users, nil
}
func (us SqlUserStore) GetByUsername(username string) (*model.User, *model.AppError) {
query := us.usersQuery.Where("u.Username = ?", username)