[MM-56284] Remove non-generic StoreResult (#25750)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
502cd6ef7d
Коммит
edc305716f
@@ -122,17 +122,17 @@ func (s *SearchUserStore) autocompleteUsersInChannelByEngine(engine searchengine
|
||||
return nil, err
|
||||
}
|
||||
|
||||
uchan := make(chan store.GenericStoreResult[[]*model.User], 1)
|
||||
uchan := make(chan store.StoreResult[[]*model.User], 1)
|
||||
go func() {
|
||||
users, nErr := s.UserStore.GetProfileByIds(context.Background(), uchanIds, nil, false)
|
||||
uchan <- store.GenericStoreResult[[]*model.User]{Data: users, NErr: nErr}
|
||||
uchan <- store.StoreResult[[]*model.User]{Data: users, NErr: nErr}
|
||||
close(uchan)
|
||||
}()
|
||||
|
||||
nuchan := make(chan store.GenericStoreResult[[]*model.User], 1)
|
||||
nuchan := make(chan store.StoreResult[[]*model.User], 1)
|
||||
go func() {
|
||||
users, nErr := s.UserStore.GetProfileByIds(context.Background(), nuchanIds, nil, false)
|
||||
nuchan <- store.GenericStoreResult[[]*model.User]{Data: users, NErr: nErr}
|
||||
nuchan <- store.StoreResult[[]*model.User]{Data: users, NErr: nErr}
|
||||
close(nuchan)
|
||||
}()
|
||||
|
||||
|
||||
@@ -1230,16 +1230,16 @@ func (s *SqlPostStore) GetPosts(options model.GetPostsOptions, _ bool, sanitizeO
|
||||
}
|
||||
offset := options.PerPage * options.Page
|
||||
|
||||
rpc := make(chan store.GenericStoreResult[[]*model.Post], 1)
|
||||
rpc := make(chan store.StoreResult[[]*model.Post], 1)
|
||||
go func() {
|
||||
posts, err := s.getRootPosts(options.ChannelId, offset, options.PerPage, options.SkipFetchThreads, options.IncludeDeleted)
|
||||
rpc <- store.GenericStoreResult[[]*model.Post]{Data: posts, NErr: err}
|
||||
rpc <- store.StoreResult[[]*model.Post]{Data: posts, NErr: err}
|
||||
close(rpc)
|
||||
}()
|
||||
cpc := make(chan store.GenericStoreResult[[]*model.Post], 1)
|
||||
cpc := make(chan store.StoreResult[[]*model.Post], 1)
|
||||
go func() {
|
||||
posts, err := s.getParentsPosts(options.ChannelId, offset, options.PerPage, options.SkipFetchThreads, options.IncludeDeleted)
|
||||
cpc <- store.GenericStoreResult[[]*model.Post]{Data: posts, NErr: err}
|
||||
cpc <- store.StoreResult[[]*model.Post]{Data: posts, NErr: err}
|
||||
close(cpc)
|
||||
}()
|
||||
|
||||
@@ -2769,7 +2769,7 @@ func (s *SqlPostStore) SearchPostsForUser(rctx request.CTX, paramsList []*model.
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
||||
pchan := make(chan store.GenericStoreResult[*model.PostList], len(paramsList))
|
||||
pchan := make(chan store.StoreResult[*model.PostList], len(paramsList))
|
||||
|
||||
for _, params := range paramsList {
|
||||
// remove any unquoted term that contains only non-alphanumeric chars
|
||||
@@ -2781,7 +2781,7 @@ func (s *SqlPostStore) SearchPostsForUser(rctx request.CTX, paramsList []*model.
|
||||
go func(params *model.SearchParams) {
|
||||
defer wg.Done()
|
||||
postList, err := s.search(teamId, userId, params, false, false)
|
||||
pchan <- store.GenericStoreResult[*model.PostList]{Data: postList, NErr: err}
|
||||
pchan <- store.StoreResult[*model.PostList]{Data: postList, NErr: err}
|
||||
}(params)
|
||||
}
|
||||
|
||||
|
||||
@@ -16,17 +16,7 @@ import (
|
||||
"github.com/mattermost/mattermost/server/v8/channels/product"
|
||||
)
|
||||
|
||||
// Deprecated: Use GenericStoreResult instead.
|
||||
type StoreResult struct {
|
||||
Data any
|
||||
|
||||
// NErr a temporary field used by the new code for the AppError migration. This will later become Err when the entire store is migrated.
|
||||
NErr error
|
||||
}
|
||||
|
||||
// GenericStoreResult is a type safe version of StoreResult.
|
||||
// Once all the code is migrated to use GenericStoreResult, it should be renamed to StoreResult.
|
||||
type GenericStoreResult[T any] struct {
|
||||
type StoreResult[T any] struct {
|
||||
Data T
|
||||
|
||||
// NErr a temporary field used by the new code for the AppError migration. This will later become Err when the entire store is migrated.
|
||||
|
||||
Ссылка в новой задаче
Block a user