Poststore migration part3 (#15505)
* Migration completed * Order in translations file * Fix: lints * Trigger CI * Fix message key * Change mlog.Error for mlog.Warn * Fix imports * Adding translations needed for EE * Trigger CI * Fix merge with master Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cd7d68effb
Коммит
8118cac350
@@ -105,7 +105,7 @@ func (s LocalCachePostStore) GetPostsSince(options model.GetPostsSinceOptions, a
|
||||
return list, err
|
||||
}
|
||||
|
||||
func (s LocalCachePostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, *model.AppError) {
|
||||
func (s LocalCachePostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, error) {
|
||||
if !allowFromCache {
|
||||
return s.PostStore.GetPosts(options, allowFromCache)
|
||||
}
|
||||
|
||||
@@ -4713,7 +4713,7 @@ func (s *OpenTracingLayerPluginStore) SetWithOptions(pluginId string, key string
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.AnalyticsPostCount")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -4731,7 +4731,7 @@ func (s *OpenTracingLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFi
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.AnalyticsPostCountsByDay")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -4749,7 +4749,7 @@ func (s *OpenTracingLayerPostStore) AnalyticsPostCountsByDay(options *model.Anal
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.AnalyticsUserCountsWithPostsByDay")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -4816,7 +4816,7 @@ func (s *OpenTracingLayerPostStore) Get(id string, skipFetchThreads bool) (*mode
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetDirectPostParentsForExportAfter")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -4922,7 +4922,7 @@ func (s *OpenTracingLayerPostStore) GetMaxPostSize() int {
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetOldest() (*model.Post, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetOldest")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -4940,7 +4940,7 @@ func (s *OpenTracingLayerPostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetOldestEntityCreationTime() (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetOldestEntityCreationTime() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetOldestEntityCreationTime")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -4958,7 +4958,7 @@ func (s *OpenTracingLayerPostStore) GetOldestEntityCreationTime() (int64, *model
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetParentsForExportAfter")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5030,7 +5030,7 @@ func (s *OpenTracingLayerPostStore) GetPostIdBeforeTime(channelId string, time i
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetPosts")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5066,7 +5066,7 @@ func (s *OpenTracingLayerPostStore) GetPostsAfter(options model.GetPostsOptions)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetPostsBatchForIndexing")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5102,7 +5102,7 @@ func (s *OpenTracingLayerPostStore) GetPostsBefore(options model.GetPostsOptions
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetPostsByIds")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5120,7 +5120,7 @@ func (s *OpenTracingLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Po
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetPostsCreatedAt")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5156,7 +5156,7 @@ func (s *OpenTracingLayerPostStore) GetPostsSince(options model.GetPostsSinceOpt
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetRepliesForExport")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5205,7 +5205,7 @@ func (s *OpenTracingLayerPostStore) InvalidateLastPostTimeCache(channelId string
|
||||
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) Overwrite(post *model.Post) (*model.Post, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) Overwrite(post *model.Post) (*model.Post, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.Overwrite")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5223,7 +5223,7 @@ func (s *OpenTracingLayerPostStore) Overwrite(post *model.Post) (*model.Post, *m
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.OverwriteMultiple")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5241,7 +5241,7 @@ func (s *OpenTracingLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*m
|
||||
return result, resultVar1, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.PermanentDeleteBatch")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5331,7 +5331,7 @@ func (s *OpenTracingLayerPostStore) SaveMultiple(posts []*model.Post) ([]*model.
|
||||
return result, resultVar1, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.Search")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -5349,7 +5349,7 @@ func (s *OpenTracingLayerPostStore) Search(teamId string, userId string, params
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, *model.AppError) {
|
||||
func (s *OpenTracingLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.SearchPostsInTeamForUser")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
|
||||
@@ -4070,21 +4070,63 @@ func (s *RetryLayerPluginStore) SetWithOptions(pluginId string, key string, valu
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, error) {
|
||||
|
||||
return s.PostStore.AnalyticsPostCount(teamId, mustHaveFile, mustHaveHashtag)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.AnalyticsPostCount(teamId, mustHaveFile, mustHaveHashtag)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) {
|
||||
|
||||
return s.PostStore.AnalyticsPostCountsByDay(options)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.AnalyticsPostCountsByDay(options)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, error) {
|
||||
|
||||
return s.PostStore.AnalyticsUserCountsWithPostsByDay(teamId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.AnalyticsUserCountsWithPostsByDay(teamId)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4134,9 +4176,23 @@ func (s *RetryLayerPostStore) Get(id string, skipFetchThreads bool) (*model.Post
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, error) {
|
||||
|
||||
return s.PostStore.GetDirectPostParentsForExportAfter(limit, afterId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetDirectPostParentsForExportAfter(limit, afterId)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4212,21 +4268,63 @@ func (s *RetryLayerPostStore) GetMaxPostSize() int {
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetOldest() (*model.Post, error) {
|
||||
|
||||
return s.PostStore.GetOldest()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetOldest()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetOldestEntityCreationTime() (int64, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetOldestEntityCreationTime() (int64, error) {
|
||||
|
||||
return s.PostStore.GetOldestEntityCreationTime()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetOldestEntityCreationTime()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, error) {
|
||||
|
||||
return s.PostStore.GetParentsForExportAfter(limit, afterId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetParentsForExportAfter(limit, afterId)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4290,9 +4388,23 @@ func (s *RetryLayerPostStore) GetPostIdBeforeTime(channelId string, time int64)
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, error) {
|
||||
|
||||
return s.PostStore.GetPosts(options, allowFromCache)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetPosts(options, allowFromCache)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4316,9 +4428,23 @@ func (s *RetryLayerPostStore) GetPostsAfter(options model.GetPostsOptions) (*mod
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error) {
|
||||
|
||||
return s.PostStore.GetPostsBatchForIndexing(startTime, endTime, limit)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetPostsBatchForIndexing(startTime, endTime, limit)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4342,15 +4468,43 @@ func (s *RetryLayerPostStore) GetPostsBefore(options model.GetPostsOptions) (*mo
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) {
|
||||
|
||||
return s.PostStore.GetPostsByIds(postIds)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetPostsByIds(postIds)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, error) {
|
||||
|
||||
return s.PostStore.GetPostsCreatedAt(channelId, time)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetPostsCreatedAt(channelId, time)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4374,9 +4528,23 @@ func (s *RetryLayerPostStore) GetPostsSince(options model.GetPostsSinceOptions,
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, error) {
|
||||
|
||||
return s.PostStore.GetRepliesForExport(parentId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetRepliesForExport(parentId)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4406,21 +4574,63 @@ func (s *RetryLayerPostStore) InvalidateLastPostTimeCache(channelId string) {
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) Overwrite(post *model.Post) (*model.Post, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) Overwrite(post *model.Post) (*model.Post, error) {
|
||||
|
||||
return s.PostStore.Overwrite(post)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.Overwrite(post)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) {
|
||||
|
||||
return s.PostStore.OverwriteMultiple(posts)
|
||||
tries := 0
|
||||
for {
|
||||
result, resultVar1, err := s.PostStore.OverwriteMultiple(posts)
|
||||
if err == nil {
|
||||
return result, resultVar1, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, resultVar1, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, resultVar1, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) {
|
||||
|
||||
return s.PostStore.PermanentDeleteBatch(endTime, limit)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.PermanentDeleteBatch(endTime, limit)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4504,15 +4714,43 @@ func (s *RetryLayerPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post,
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, error) {
|
||||
|
||||
return s.PostStore.Search(teamId, userId, params)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.Search(teamId, userId, params)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, error) {
|
||||
|
||||
return s.PostStore.SearchPostsInTeamForUser(paramsList, userId, teamId, page, perPage)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.SearchPostsInTeamForUser(paramsList, userId, teamId, page, perPage)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ func (s SearchPostStore) Update(newPost, oldPost *model.Post) (*model.Post, erro
|
||||
return post, err
|
||||
}
|
||||
|
||||
func (s *SearchPostStore) Overwrite(post *model.Post) (*model.Post, *model.AppError) {
|
||||
func (s *SearchPostStore) Overwrite(post *model.Post) (*model.Post, error) {
|
||||
post, err := s.PostStore.Overwrite(post)
|
||||
if err == nil {
|
||||
s.indexPost(post)
|
||||
@@ -131,7 +131,7 @@ func (s SearchPostStore) PermanentDeleteByChannel(channelID string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s SearchPostStore) searchPostsInTeamForUserByEngine(engine searchengine.SearchEngineInterface, paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, *model.AppError) {
|
||||
func (s SearchPostStore) searchPostsInTeamForUserByEngine(engine searchengine.SearchEngineInterface, paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, error) {
|
||||
if err := model.IsSearchParamsListValid(paramsList); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -173,7 +173,7 @@ func (s SearchPostStore) searchPostsInTeamForUserByEngine(engine searchengine.Se
|
||||
return model.MakePostSearchResults(postList, matches), nil
|
||||
}
|
||||
|
||||
func (s SearchPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, *model.AppError) {
|
||||
func (s SearchPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, error) {
|
||||
for _, engine := range s.rootStore.searchEngine.GetActiveEngines() {
|
||||
if engine.IsSearchEnabled() {
|
||||
results, err := s.searchPostsInTeamForUserByEngine(engine, paramsList, userId, teamId, page, perPage)
|
||||
|
||||
@@ -6,7 +6,6 @@ package sqlstore
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -14,9 +13,9 @@ import (
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/store/searchlayer"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
"github.com/mattermost/mattermost-server/v5/einterfaces"
|
||||
"github.com/mattermost/mattermost-server/v5/mlog"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
@@ -205,7 +204,7 @@ func (s *SqlPostStore) Save(post *model.Post) (*model.Post, error) {
|
||||
return posts[0], nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) populateReplyCount(posts []*model.Post) *model.AppError {
|
||||
func (s *SqlPostStore) populateReplyCount(posts []*model.Post) error {
|
||||
rootIds := []string{}
|
||||
for _, post := range posts {
|
||||
rootIds = append(rootIds, post.RootId)
|
||||
@@ -218,11 +217,11 @@ func (s *SqlPostStore) populateReplyCount(posts []*model.Post) *model.AppError {
|
||||
|
||||
queryString, args, err := query.ToSql()
|
||||
if err != nil {
|
||||
return model.NewAppError("SqlPostStore.populateReplyCount", "store.sql_post.populate_reply_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return errors.Wrap(err, "post_tosql")
|
||||
}
|
||||
_, err = s.GetMaster().Select(&countList, queryString, args...)
|
||||
if err != nil {
|
||||
return model.NewAppError("SqlPostStore.populateReplyCount", "store.sql_post.populate_reply_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return errors.Wrap(err, "failed to count Posts")
|
||||
}
|
||||
|
||||
counts := map[string]int64{}
|
||||
@@ -274,7 +273,7 @@ func (s *SqlPostStore) Update(newPost *model.Post, oldPost *model.Post) (*model.
|
||||
return newPost, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, *model.AppError) {
|
||||
func (s *SqlPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) {
|
||||
updateAt := model.GetMillis()
|
||||
maxPostSize := s.GetMaxPostSize()
|
||||
for idx, post := range posts {
|
||||
@@ -286,27 +285,27 @@ func (s *SqlPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, in
|
||||
|
||||
tx, err := s.GetMaster().Begin()
|
||||
if err != nil {
|
||||
return nil, -1, model.NewAppError("SqlPostStore.Overwrite", "store.sql_post.overwrite.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, -1, errors.Wrap(err, "begin_transaction")
|
||||
}
|
||||
for idx, post := range posts {
|
||||
if _, err = tx.Update(post); err != nil {
|
||||
txErr := tx.Rollback()
|
||||
if txErr != nil {
|
||||
return nil, idx, model.NewAppError("SqlPostStore.Overwrite", "store.sql_post.overwrite.app_error", nil, txErr.Error(), http.StatusInternalServerError)
|
||||
return nil, idx, errors.Wrap(txErr, "rollback_transaction")
|
||||
}
|
||||
|
||||
return nil, idx, model.NewAppError("SqlPostStore.Overwrite", "store.sql_post.overwrite.app_error", nil, "id="+post.Id+", "+err.Error(), http.StatusInternalServerError)
|
||||
return nil, idx, errors.Wrap(err, "failed to update Post")
|
||||
}
|
||||
}
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
return nil, -1, model.NewAppError("SqlPostStore.Overwrite", "store.sql_post.overwrite.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, -1, errors.Wrap(err, "commit_transaction")
|
||||
}
|
||||
|
||||
return posts, -1, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) Overwrite(post *model.Post) (*model.Post, *model.AppError) {
|
||||
func (s *SqlPostStore) Overwrite(post *model.Post) (*model.Post, error) {
|
||||
posts, _, err := s.OverwriteMultiple([]*model.Post{post})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -558,36 +557,35 @@ func (s *SqlPostStore) PermanentDeleteByChannel(channelId string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetPosts(options model.GetPostsOptions, _ bool) (*model.PostList, *model.AppError) {
|
||||
func (s *SqlPostStore) GetPosts(options model.GetPostsOptions, _ bool) (*model.PostList, error) {
|
||||
if options.PerPage > 1000 {
|
||||
return nil, model.NewAppError("SqlPostStore.GetLinearPosts", "store.sql_post.get_posts.app_error", nil, "channelId="+options.ChannelId, http.StatusBadRequest)
|
||||
return nil, store.NewErrInvalidInput("Post", "<options.PerPage>", options.PerPage)
|
||||
}
|
||||
offset := options.PerPage * options.Page
|
||||
|
||||
rpc := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
posts, err := s.getRootPosts(options.ChannelId, offset, options.PerPage, options.SkipFetchThreads)
|
||||
rpc <- store.StoreResult{Data: posts, Err: err}
|
||||
rpc <- store.StoreResult{Data: posts, NErr: err}
|
||||
close(rpc)
|
||||
}()
|
||||
cpc := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
posts, err := s.getParentsPosts(options.ChannelId, offset, options.PerPage, options.SkipFetchThreads)
|
||||
cpc <- store.StoreResult{Data: posts, Err: err}
|
||||
cpc <- store.StoreResult{Data: posts, NErr: err}
|
||||
close(cpc)
|
||||
}()
|
||||
|
||||
var err *model.AppError
|
||||
list := model.NewPostList()
|
||||
|
||||
rpr := <-rpc
|
||||
if rpr.Err != nil {
|
||||
return nil, rpr.Err
|
||||
if rpr.NErr != nil {
|
||||
return nil, rpr.NErr
|
||||
}
|
||||
|
||||
cpr := <-cpc
|
||||
if cpr.Err != nil {
|
||||
return nil, cpr.Err
|
||||
if cpr.NErr != nil {
|
||||
return nil, cpr.NErr
|
||||
}
|
||||
|
||||
posts := rpr.Data.([]*model.Post)
|
||||
@@ -604,7 +602,7 @@ func (s *SqlPostStore) GetPosts(options model.GetPostsOptions, _ bool) (*model.P
|
||||
|
||||
list.MakeNonNil()
|
||||
|
||||
return list, err
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetPostsSince(options model.GetPostsSinceOptions, allowFromCache bool) (*model.PostList, error) {
|
||||
@@ -661,6 +659,7 @@ func (s *SqlPostStore) GetPostsSince(options model.GetPostsSinceOptions, allowFr
|
||||
ORDER BY CreateAt DESC`
|
||||
}
|
||||
_, err := s.GetReplica().Select(&posts, query, map[string]interface{}{"ChannelId": options.ChannelId, "Time": options.Time})
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to find Posts with channelId=%s", options.ChannelId)
|
||||
}
|
||||
@@ -892,7 +891,7 @@ func (s *SqlPostStore) GetPostAfterTime(channelId string, time int64) (*model.Po
|
||||
return post, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) getRootPosts(channelId string, offset int, limit int, skipFetchThreads bool) ([]*model.Post, *model.AppError) {
|
||||
func (s *SqlPostStore) getRootPosts(channelId string, offset int, limit int, skipFetchThreads bool) ([]*model.Post, error) {
|
||||
var posts []*model.Post
|
||||
var fetchQuery string
|
||||
if skipFetchThreads {
|
||||
@@ -902,12 +901,12 @@ func (s *SqlPostStore) getRootPosts(channelId string, offset int, limit int, ski
|
||||
}
|
||||
_, err := s.GetReplica().Select(&posts, fetchQuery, map[string]interface{}{"ChannelId": channelId, "Offset": offset, "Limit": limit})
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetLinearPosts", "store.sql_post.get_root_posts.app_error", nil, "channelId="+channelId+err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) getParentsPosts(channelId string, offset int, limit int, skipFetchThreads bool) ([]*model.Post, *model.AppError) {
|
||||
func (s *SqlPostStore) getParentsPosts(channelId string, offset int, limit int, skipFetchThreads bool) ([]*model.Post, error) {
|
||||
if s.DriverName() == model.DATABASE_DRIVER_POSTGRES {
|
||||
return s.getParentsPostsPostgreSQL(channelId, offset, limit, skipFetchThreads)
|
||||
}
|
||||
@@ -933,7 +932,7 @@ func (s *SqlPostStore) getParentsPosts(channelId string, offset int, limit int,
|
||||
|
||||
_, err := s.GetReplica().Select(&roots, rootQuery, map[string]interface{}{"ChannelId": channelId, "Offset": offset, "Limit": limit})
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetLinearPosts", "store.sql_post.get_parents_posts.app_error", nil, "channelId="+channelId+" err="+err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
if len(roots) == 0 {
|
||||
return nil, nil
|
||||
@@ -966,12 +965,12 @@ func (s *SqlPostStore) getParentsPosts(channelId string, offset int, limit int,
|
||||
ORDER BY CreateAt`,
|
||||
params)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetLinearPosts", "store.sql_post.get_parents_posts.app_error", nil, "channelId="+channelId+" err="+err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) getParentsPostsPostgreSQL(channelId string, offset int, limit int, skipFetchThreads bool) ([]*model.Post, *model.AppError) {
|
||||
func (s *SqlPostStore) getParentsPostsPostgreSQL(channelId string, offset int, limit int, skipFetchThreads bool) ([]*model.Post, error) {
|
||||
var posts []*model.Post
|
||||
replyCountQuery := ""
|
||||
onStatement := "q1.RootId = q2.Id"
|
||||
@@ -1005,7 +1004,7 @@ func (s *SqlPostStore) getParentsPostsPostgreSQL(channelId string, offset int, l
|
||||
ORDER BY CreateAt`,
|
||||
map[string]interface{}{"ChannelId1": channelId, "Offset": offset, "Limit": limit, "ChannelId2": channelId})
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetLinearPosts", "store.sql_post.get_parents_posts.app_error", nil, "channelId="+channelId+" err="+err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrapf(err, "failed to find Posts with channelId=%s", channelId)
|
||||
}
|
||||
return posts, nil
|
||||
}
|
||||
@@ -1151,11 +1150,11 @@ func (s *SqlPostStore) buildSearchPostFilterClause(fromUsers []string, excludedU
|
||||
return filterQuery, queryParams
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, *model.AppError) {
|
||||
func (s *SqlPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, error) {
|
||||
return s.search(teamId, userId, params, true, true)
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) search(teamId string, userId string, params *model.SearchParams, channelsByName bool, userByUsername bool) (*model.PostList, *model.AppError) {
|
||||
func (s *SqlPostStore) search(teamId string, userId string, params *model.SearchParams, channelsByName bool, userByUsername bool) (*model.PostList, error) {
|
||||
queryParams := map[string]interface{}{
|
||||
"TeamId": teamId,
|
||||
"UserId": userId,
|
||||
@@ -1266,7 +1265,7 @@ func (s *SqlPostStore) search(teamId string, userId string, params *model.Search
|
||||
var err error
|
||||
terms, err = removeMysqlStopWordsFromTerms(terms)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.search", "store.sql_post.search.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to remove Mysql stop-words from terms")
|
||||
}
|
||||
|
||||
if terms == "" {
|
||||
@@ -1338,7 +1337,7 @@ func removeMysqlStopWordsFromTerms(terms string) (string, error) {
|
||||
return strings.Join(newTerms, " "), nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, error) {
|
||||
query :=
|
||||
`SELECT DISTINCT
|
||||
DATE(FROM_UNIXTIME(Posts.CreateAt / 1000)) AS Name,
|
||||
@@ -1383,12 +1382,12 @@ func (s *SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.A
|
||||
query,
|
||||
map[string]interface{}{"TeamId": teamId, "StartTime": start, "EndTime": end})
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.AnalyticsUserCountsWithPostsByDay", "store.sql_post.analytics_user_counts_posts_by_day.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrapf(err, "failed to find Posts with teamId=%s", teamId)
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) {
|
||||
|
||||
query :=
|
||||
`SELECT
|
||||
@@ -1447,12 +1446,12 @@ func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCoun
|
||||
query,
|
||||
map[string]interface{}{"TeamId": options.TeamId, "StartTime": start, "EndTime": end})
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.AnalyticsPostCountsByDay", "store.sql_post.analytics_posts_count_by_day.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrapf(err, "failed to find Posts with teamId=%s", options.TeamId)
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, *model.AppError) {
|
||||
func (s *SqlPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, error) {
|
||||
query :=
|
||||
`SELECT
|
||||
COUNT(Posts.Id) AS Value
|
||||
@@ -1476,25 +1475,25 @@ func (s *SqlPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, must
|
||||
|
||||
v, err := s.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId})
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("SqlPostStore.AnalyticsPostCount", "store.sql_post.analytics_posts_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return 0, errors.Wrap(err, "failed to count Posts")
|
||||
}
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, *model.AppError) {
|
||||
func (s *SqlPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, error) {
|
||||
query := `SELECT * FROM Posts WHERE CreateAt = :CreateAt AND ChannelId = :ChannelId`
|
||||
|
||||
var posts []*model.Post
|
||||
_, err := s.GetReplica().Select(&posts, query, map[string]interface{}{"CreateAt": time, "ChannelId": channelId})
|
||||
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetPostsCreatedAt", "store.sql_post.get_posts_created_att.app_error", nil, "channelId="+channelId+err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrapf(err, "failed to find Posts with channelId=%s", channelId)
|
||||
}
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetPostsByIds(postIds []string) ([]*model.Post, *model.AppError) {
|
||||
func (s *SqlPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) {
|
||||
keys, params := MapStringsToQueryParams(postIds, "Post")
|
||||
|
||||
query := `SELECT p.*, (SELECT count(Posts.Id) FROM Posts WHERE Posts.RootId = (CASE WHEN p.RootId = '' THEN p.Id ELSE p.RootId END) AND Posts.DeleteAt = 0) as ReplyCount FROM Posts p WHERE p.Id IN ` + keys + ` ORDER BY CreateAt DESC`
|
||||
@@ -1503,13 +1502,12 @@ func (s *SqlPostStore) GetPostsByIds(postIds []string) ([]*model.Post, *model.Ap
|
||||
_, err := s.GetReplica().Select(&posts, query, params)
|
||||
|
||||
if err != nil {
|
||||
mlog.Error("Query error getting posts.", mlog.Err(err))
|
||||
return nil, model.NewAppError("SqlPostStore.GetPostsByIds", "store.sql_post.get_posts_by_ids.app_error", nil, "", http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, *model.AppError) {
|
||||
func (s *SqlPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error) {
|
||||
var posts []*model.PostForIndexing
|
||||
_, err := s.GetSearchReplica().Select(&posts,
|
||||
`SELECT
|
||||
@@ -1541,12 +1539,12 @@ func (s *SqlPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64,
|
||||
map[string]interface{}{"StartTime": startTime, "EndTime": endTime, "NumPosts": limit})
|
||||
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetPostContext", "store.sql_post.get_posts_batch_for_indexing.get.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError) {
|
||||
func (s *SqlPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) {
|
||||
var query string
|
||||
if s.DriverName() == "postgres" {
|
||||
query = "DELETE from Posts WHERE Id = any (array (SELECT Id FROM Posts WHERE CreateAt < :EndTime LIMIT :Limit))"
|
||||
@@ -1556,21 +1554,25 @@ func (s *SqlPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64,
|
||||
|
||||
sqlResult, err := s.GetMaster().Exec(query, map[string]interface{}{"EndTime": endTime, "Limit": limit})
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("SqlPostStore.PermanentDeleteBatch", "store.sql_post.permanent_delete_batch.app_error", nil, ""+err.Error(), http.StatusInternalServerError)
|
||||
return 0, errors.Wrap(err, "failed to delete Posts")
|
||||
}
|
||||
|
||||
rowsAffected, err := sqlResult.RowsAffected()
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("SqlPostStore.PermanentDeleteBatch", "store.sql_post.permanent_delete_batch.app_error", nil, ""+err.Error(), http.StatusInternalServerError)
|
||||
return 0, errors.Wrap(err, "failed to delete Posts")
|
||||
}
|
||||
return rowsAffected, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
func (s *SqlPostStore) GetOldest() (*model.Post, error) {
|
||||
var post model.Post
|
||||
err := s.GetReplica().SelectOne(&post, "SELECT * FROM Posts ORDER BY CreateAt LIMIT 1")
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetOldest", "app.post.get.app_error", nil, err.Error(), http.StatusNotFound)
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, store.NewErrNotFound("Post", "none")
|
||||
}
|
||||
|
||||
return nil, errors.Wrap(err, "failed to get oldest Post")
|
||||
}
|
||||
|
||||
return &post, nil
|
||||
@@ -1591,7 +1593,7 @@ func (s *SqlPostStore) determineMaxPostSize() int {
|
||||
table_name = 'posts'
|
||||
AND column_name = 'message'
|
||||
`); err != nil {
|
||||
mlog.Error("Unable to determine the maximum supported post size", mlog.Err(err))
|
||||
mlog.Warn("Unable to determine the maximum supported post size", mlog.Err(err))
|
||||
}
|
||||
} else if s.DriverName() == model.DATABASE_DRIVER_MYSQL {
|
||||
// The Post.Message column in MySQL has historically been TEXT, with a maximum
|
||||
@@ -1636,7 +1638,7 @@ func (s *SqlPostStore) GetMaxPostSize() int {
|
||||
return s.maxPostSizeCached
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, *model.AppError) {
|
||||
func (s *SqlPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, error) {
|
||||
for {
|
||||
var rootIds []string
|
||||
_, err := s.GetReplica().Select(&rootIds,
|
||||
@@ -1652,8 +1654,7 @@ func (s *SqlPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*m
|
||||
LIMIT :Limit`,
|
||||
map[string]interface{}{"Limit": limit, "AfterId": afterId})
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetAllAfterForExport", "store.sql_post.get_posts.app_error",
|
||||
nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
|
||||
var postsForExport []*model.PostForExport
|
||||
@@ -1683,8 +1684,7 @@ func (s *SqlPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*m
|
||||
p1.Id`,
|
||||
params)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetAllAfterForExport", "store.sql_post.get_posts.app_error",
|
||||
nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
|
||||
if len(postsForExport) == 0 {
|
||||
@@ -1698,7 +1698,7 @@ func (s *SqlPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*m
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetRepliesForExport(rootId string) ([]*model.ReplyForExport, *model.AppError) {
|
||||
func (s *SqlPostStore) GetRepliesForExport(rootId string) ([]*model.ReplyForExport, error) {
|
||||
var posts []*model.ReplyForExport
|
||||
_, err := s.GetSearchReplica().Select(&posts, `
|
||||
SELECT
|
||||
@@ -1716,13 +1716,13 @@ func (s *SqlPostStore) GetRepliesForExport(rootId string) ([]*model.ReplyForExpo
|
||||
map[string]interface{}{"RootId": rootId})
|
||||
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetAllAfterForExport", "store.sql_post.get_posts.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, *model.AppError) {
|
||||
func (s *SqlPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, error) {
|
||||
query := s.getQueryBuilder().
|
||||
Select("p.*", "Users.Username as User").
|
||||
From("Posts p").
|
||||
@@ -1741,12 +1741,12 @@ func (s *SqlPostStore) GetDirectPostParentsForExportAfter(limit int, afterId str
|
||||
|
||||
queryString, args, err := query.ToSql()
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetDirectPostParentsForExportAfter", "store.sql_post.get_direct_posts.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "post_tosql")
|
||||
}
|
||||
|
||||
var posts []*model.DirectPostForExport
|
||||
if _, err = s.GetReplica().Select(&posts, queryString, args...); err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetDirectPostParentsForExportAfter", "store.sql_post.get_direct_posts.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find Posts")
|
||||
}
|
||||
var channelIds []string
|
||||
for _, post := range posts {
|
||||
@@ -1762,12 +1762,12 @@ func (s *SqlPostStore) GetDirectPostParentsForExportAfter(limit int, afterId str
|
||||
|
||||
queryString, args, err = query.ToSql()
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetDirectPostParentsForExportAfter", "store.sql_post.get_direct_posts.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "post_tosql")
|
||||
}
|
||||
|
||||
var channelMembers []*model.ChannelMemberForExport
|
||||
if _, err := s.GetReplica().Select(&channelMembers, queryString, args...); err != nil {
|
||||
return nil, model.NewAppError("SqlPostStore.GetDirectPostParentsForExportAfter", "store.sql_post.get_direct_posts.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return nil, errors.Wrap(err, "failed to find ChannelMembers")
|
||||
}
|
||||
|
||||
// Build a map of channels and their posts
|
||||
@@ -1792,7 +1792,7 @@ func (s *SqlPostStore) GetDirectPostParentsForExportAfter(limit int, afterId str
|
||||
return posts, nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, *model.AppError) {
|
||||
func (s *SqlPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, error) {
|
||||
// Since we don't support paging for DB search, we just return nothing for later pages
|
||||
if page > 0 {
|
||||
return model.MakePostSearchResults(model.NewPostList(), nil), nil
|
||||
@@ -1816,7 +1816,7 @@ func (s *SqlPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams
|
||||
go func(params *model.SearchParams) {
|
||||
defer wg.Done()
|
||||
postList, err := s.search(teamId, userId, params, false, false)
|
||||
pchan <- store.StoreResult{Data: postList, Err: err}
|
||||
pchan <- store.StoreResult{Data: postList, NErr: err}
|
||||
}(params)
|
||||
}
|
||||
|
||||
@@ -1826,8 +1826,8 @@ func (s *SqlPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams
|
||||
posts := model.NewPostList()
|
||||
|
||||
for result := range pchan {
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
if result.NErr != nil {
|
||||
return nil, result.NErr
|
||||
}
|
||||
data := result.Data.(*model.PostList)
|
||||
posts.Extend(data)
|
||||
@@ -1838,7 +1838,7 @@ func (s *SqlPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams
|
||||
return model.MakePostSearchResults(posts, nil), nil
|
||||
}
|
||||
|
||||
func (s *SqlPostStore) GetOldestEntityCreationTime() (int64, *model.AppError) {
|
||||
func (s *SqlPostStore) GetOldestEntityCreationTime() (int64, error) {
|
||||
query := s.getQueryBuilder().Select("MIN(min_createat) min_createat").
|
||||
Suffix(`FROM (
|
||||
(SELECT MIN(createat) min_createat FROM Posts)
|
||||
@@ -1849,14 +1849,12 @@ func (s *SqlPostStore) GetOldestEntityCreationTime() (int64, *model.AppError) {
|
||||
) entities`)
|
||||
queryString, _, err := query.ToSql()
|
||||
if err != nil {
|
||||
return -1, model.NewAppError("SqlPostStore.GetOldestEntityCreationTime",
|
||||
"store.sql_post.get_oldest_entity_creation_time.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return -1, errors.Wrap(err, "post_tosql")
|
||||
}
|
||||
row := s.GetReplica().Db.QueryRow(queryString)
|
||||
var oldest int64
|
||||
if err := row.Scan(&oldest); err != nil {
|
||||
return -1, model.NewAppError("SqlPostStore.GetOldestEntityCreationTime",
|
||||
"store.sql_post.get_oldest_entity_creation_time.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
return -1, errors.Wrap(err, "unable to scan oldest entity creation time")
|
||||
}
|
||||
return oldest, nil
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ type PostStore interface {
|
||||
Delete(postId string, time int64, deleteByID string) error
|
||||
PermanentDeleteByUser(userId string) error
|
||||
PermanentDeleteByChannel(channelId string) error
|
||||
GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, *model.AppError)
|
||||
GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, error)
|
||||
GetFlaggedPosts(userId string, offset int, limit int) (*model.PostList, error)
|
||||
// @openTracingParams userId, teamId, offset, limit
|
||||
GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) (*model.PostList, error)
|
||||
@@ -267,25 +267,25 @@ type PostStore interface {
|
||||
GetPostIdAfterTime(channelId string, time int64) (string, error)
|
||||
GetPostIdBeforeTime(channelId string, time int64) (string, error)
|
||||
GetEtag(channelId string, allowFromCache bool) string
|
||||
Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, *model.AppError)
|
||||
AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, *model.AppError)
|
||||
AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, *model.AppError)
|
||||
AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, *model.AppError)
|
||||
Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, error)
|
||||
AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, error)
|
||||
AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error)
|
||||
AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, error)
|
||||
ClearCaches()
|
||||
InvalidateLastPostTimeCache(channelId string)
|
||||
GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, *model.AppError)
|
||||
Overwrite(post *model.Post) (*model.Post, *model.AppError)
|
||||
OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, *model.AppError)
|
||||
GetPostsByIds(postIds []string) ([]*model.Post, *model.AppError)
|
||||
GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, *model.AppError)
|
||||
PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError)
|
||||
GetOldest() (*model.Post, *model.AppError)
|
||||
GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, error)
|
||||
Overwrite(post *model.Post) (*model.Post, error)
|
||||
OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error)
|
||||
GetPostsByIds(postIds []string) ([]*model.Post, error)
|
||||
GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error)
|
||||
PermanentDeleteBatch(endTime int64, limit int64) (int64, error)
|
||||
GetOldest() (*model.Post, error)
|
||||
GetMaxPostSize() int
|
||||
GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, *model.AppError)
|
||||
GetRepliesForExport(parentId string) ([]*model.ReplyForExport, *model.AppError)
|
||||
GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, *model.AppError)
|
||||
SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, *model.AppError)
|
||||
GetOldestEntityCreationTime() (int64, *model.AppError)
|
||||
GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, error)
|
||||
GetRepliesForExport(parentId string) ([]*model.ReplyForExport, error)
|
||||
GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, error)
|
||||
SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, error)
|
||||
GetOldestEntityCreationTime() (int64, error)
|
||||
}
|
||||
|
||||
type UserStore interface {
|
||||
|
||||
@@ -15,7 +15,7 @@ type PostStore struct {
|
||||
}
|
||||
|
||||
// AnalyticsPostCount provides a mock function with given fields: teamId, mustHaveFile, mustHaveHashtag
|
||||
func (_m *PostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, *model.AppError) {
|
||||
func (_m *PostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, error) {
|
||||
ret := _m.Called(teamId, mustHaveFile, mustHaveHashtag)
|
||||
|
||||
var r0 int64
|
||||
@@ -25,20 +25,18 @@ func (_m *PostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHa
|
||||
r0 = ret.Get(0).(int64)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, bool, bool) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string, bool, bool) error); ok {
|
||||
r1 = rf(teamId, mustHaveFile, mustHaveHashtag)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// AnalyticsPostCountsByDay provides a mock function with given fields: options
|
||||
func (_m *PostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, *model.AppError) {
|
||||
func (_m *PostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) {
|
||||
ret := _m.Called(options)
|
||||
|
||||
var r0 model.AnalyticsRows
|
||||
@@ -50,20 +48,18 @@ func (_m *PostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCounts
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(*model.AnalyticsPostCountsOptions) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(*model.AnalyticsPostCountsOptions) error); ok {
|
||||
r1 = rf(options)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// AnalyticsUserCountsWithPostsByDay provides a mock function with given fields: teamId
|
||||
func (_m *PostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, *model.AppError) {
|
||||
func (_m *PostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, error) {
|
||||
ret := _m.Called(teamId)
|
||||
|
||||
var r0 model.AnalyticsRows
|
||||
@@ -75,13 +71,11 @@ func (_m *PostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.Ana
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(teamId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -130,7 +124,7 @@ func (_m *PostStore) Get(id string, skipFetchThreads bool) (*model.PostList, err
|
||||
}
|
||||
|
||||
// GetDirectPostParentsForExportAfter provides a mock function with given fields: limit, afterId
|
||||
func (_m *PostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, *model.AppError) {
|
||||
func (_m *PostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, error) {
|
||||
ret := _m.Called(limit, afterId)
|
||||
|
||||
var r0 []*model.DirectPostForExport
|
||||
@@ -142,13 +136,11 @@ func (_m *PostStore) GetDirectPostParentsForExportAfter(limit int, afterId strin
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(int, string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(int, string) error); ok {
|
||||
r1 = rf(limit, afterId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -252,7 +244,7 @@ func (_m *PostStore) GetMaxPostSize() int {
|
||||
}
|
||||
|
||||
// GetOldest provides a mock function with given fields:
|
||||
func (_m *PostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
func (_m *PostStore) GetOldest() (*model.Post, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 *model.Post
|
||||
@@ -264,20 +256,18 @@ func (_m *PostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetOldestEntityCreationTime provides a mock function with given fields:
|
||||
func (_m *PostStore) GetOldestEntityCreationTime() (int64, *model.AppError) {
|
||||
func (_m *PostStore) GetOldestEntityCreationTime() (int64, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 int64
|
||||
@@ -287,20 +277,18 @@ func (_m *PostStore) GetOldestEntityCreationTime() (int64, *model.AppError) {
|
||||
r0 = ret.Get(0).(int64)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetParentsForExportAfter provides a mock function with given fields: limit, afterId
|
||||
func (_m *PostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, *model.AppError) {
|
||||
func (_m *PostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, error) {
|
||||
ret := _m.Called(limit, afterId)
|
||||
|
||||
var r0 []*model.PostForExport
|
||||
@@ -312,13 +300,11 @@ func (_m *PostStore) GetParentsForExportAfter(limit int, afterId string) ([]*mod
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(int, string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(int, string) error); ok {
|
||||
r1 = rf(limit, afterId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -390,7 +376,7 @@ func (_m *PostStore) GetPostIdBeforeTime(channelId string, time int64) (string,
|
||||
}
|
||||
|
||||
// GetPosts provides a mock function with given fields: options, allowFromCache
|
||||
func (_m *PostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, *model.AppError) {
|
||||
func (_m *PostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, error) {
|
||||
ret := _m.Called(options, allowFromCache)
|
||||
|
||||
var r0 *model.PostList
|
||||
@@ -402,13 +388,11 @@ func (_m *PostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(model.GetPostsOptions, bool) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(model.GetPostsOptions, bool) error); ok {
|
||||
r1 = rf(options, allowFromCache)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -438,7 +422,7 @@ func (_m *PostStore) GetPostsAfter(options model.GetPostsOptions) (*model.PostLi
|
||||
}
|
||||
|
||||
// GetPostsBatchForIndexing provides a mock function with given fields: startTime, endTime, limit
|
||||
func (_m *PostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, *model.AppError) {
|
||||
func (_m *PostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error) {
|
||||
ret := _m.Called(startTime, endTime, limit)
|
||||
|
||||
var r0 []*model.PostForIndexing
|
||||
@@ -450,13 +434,11 @@ func (_m *PostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, li
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(int64, int64, int) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(int64, int64, int) error); ok {
|
||||
r1 = rf(startTime, endTime, limit)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -486,7 +468,7 @@ func (_m *PostStore) GetPostsBefore(options model.GetPostsOptions) (*model.PostL
|
||||
}
|
||||
|
||||
// GetPostsByIds provides a mock function with given fields: postIds
|
||||
func (_m *PostStore) GetPostsByIds(postIds []string) ([]*model.Post, *model.AppError) {
|
||||
func (_m *PostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) {
|
||||
ret := _m.Called(postIds)
|
||||
|
||||
var r0 []*model.Post
|
||||
@@ -498,20 +480,18 @@ func (_m *PostStore) GetPostsByIds(postIds []string) ([]*model.Post, *model.AppE
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func([]string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func([]string) error); ok {
|
||||
r1 = rf(postIds)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetPostsCreatedAt provides a mock function with given fields: channelId, time
|
||||
func (_m *PostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, *model.AppError) {
|
||||
func (_m *PostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, error) {
|
||||
ret := _m.Called(channelId, time)
|
||||
|
||||
var r0 []*model.Post
|
||||
@@ -523,13 +503,11 @@ func (_m *PostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.P
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, int64) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string, int64) error); ok {
|
||||
r1 = rf(channelId, time)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -559,7 +537,7 @@ func (_m *PostStore) GetPostsSince(options model.GetPostsSinceOptions, allowFrom
|
||||
}
|
||||
|
||||
// GetRepliesForExport provides a mock function with given fields: parentId
|
||||
func (_m *PostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, *model.AppError) {
|
||||
func (_m *PostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, error) {
|
||||
ret := _m.Called(parentId)
|
||||
|
||||
var r0 []*model.ReplyForExport
|
||||
@@ -571,13 +549,11 @@ func (_m *PostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExpo
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(parentId)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -612,7 +588,7 @@ func (_m *PostStore) InvalidateLastPostTimeCache(channelId string) {
|
||||
}
|
||||
|
||||
// Overwrite provides a mock function with given fields: post
|
||||
func (_m *PostStore) Overwrite(post *model.Post) (*model.Post, *model.AppError) {
|
||||
func (_m *PostStore) Overwrite(post *model.Post) (*model.Post, error) {
|
||||
ret := _m.Called(post)
|
||||
|
||||
var r0 *model.Post
|
||||
@@ -624,20 +600,18 @@ func (_m *PostStore) Overwrite(post *model.Post) (*model.Post, *model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(*model.Post) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(*model.Post) error); ok {
|
||||
r1 = rf(post)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// OverwriteMultiple provides a mock function with given fields: posts
|
||||
func (_m *PostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, *model.AppError) {
|
||||
func (_m *PostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) {
|
||||
ret := _m.Called(posts)
|
||||
|
||||
var r0 []*model.Post
|
||||
@@ -656,20 +630,18 @@ func (_m *PostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int,
|
||||
r1 = ret.Get(1).(int)
|
||||
}
|
||||
|
||||
var r2 *model.AppError
|
||||
if rf, ok := ret.Get(2).(func([]*model.Post) *model.AppError); ok {
|
||||
var r2 error
|
||||
if rf, ok := ret.Get(2).(func([]*model.Post) error); ok {
|
||||
r2 = rf(posts)
|
||||
} else {
|
||||
if ret.Get(2) != nil {
|
||||
r2 = ret.Get(2).(*model.AppError)
|
||||
}
|
||||
r2 = ret.Error(2)
|
||||
}
|
||||
|
||||
return r0, r1, r2
|
||||
}
|
||||
|
||||
// PermanentDeleteBatch provides a mock function with given fields: endTime, limit
|
||||
func (_m *PostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError) {
|
||||
func (_m *PostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) {
|
||||
ret := _m.Called(endTime, limit)
|
||||
|
||||
var r0 int64
|
||||
@@ -679,13 +651,11 @@ func (_m *PostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *m
|
||||
r0 = ret.Get(0).(int64)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(int64, int64) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(int64, int64) error); ok {
|
||||
r1 = rf(endTime, limit)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
@@ -773,7 +743,7 @@ func (_m *PostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, int, erro
|
||||
}
|
||||
|
||||
// Search provides a mock function with given fields: teamId, userId, params
|
||||
func (_m *PostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, *model.AppError) {
|
||||
func (_m *PostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, error) {
|
||||
ret := _m.Called(teamId, userId, params)
|
||||
|
||||
var r0 *model.PostList
|
||||
@@ -785,20 +755,18 @@ func (_m *PostStore) Search(teamId string, userId string, params *model.SearchPa
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, string, *model.SearchParams) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(string, string, *model.SearchParams) error); ok {
|
||||
r1 = rf(teamId, userId, params)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// SearchPostsInTeamForUser provides a mock function with given fields: paramsList, userId, teamId, page, perPage
|
||||
func (_m *PostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, *model.AppError) {
|
||||
func (_m *PostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, error) {
|
||||
ret := _m.Called(paramsList, userId, teamId, page, perPage)
|
||||
|
||||
var r0 *model.PostSearchResults
|
||||
@@ -810,13 +778,11 @@ func (_m *PostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams,
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func([]*model.SearchParams, string, string, int, int) *model.AppError); ok {
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func([]*model.SearchParams, string, string, int, int) error); ok {
|
||||
r1 = rf(paramsList, userId, teamId, page, perPage)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
|
||||
@@ -2654,8 +2654,8 @@ func testPostStoreGetDirectPostParentsForExportAfter(t *testing.T, ss store.Stor
|
||||
p1, nErr = ss.Post().Save(p1)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
r1, err := ss.Post().GetDirectPostParentsForExportAfter(10000, strings.Repeat("0", 26))
|
||||
assert.Nil(t, err)
|
||||
r1, nErr := ss.Post().GetDirectPostParentsForExportAfter(10000, strings.Repeat("0", 26))
|
||||
assert.Nil(t, nErr)
|
||||
|
||||
assert.Equal(t, p1.Message, r1[0].Message)
|
||||
|
||||
@@ -2720,8 +2720,8 @@ func testPostStoreGetDirectPostParentsForExportAfterDeleted(t *testing.T, ss sto
|
||||
_, nErr = ss.Post().Update(o1a, p1)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
r1, err := ss.Post().GetDirectPostParentsForExportAfter(10000, strings.Repeat("0", 26))
|
||||
assert.Nil(t, err)
|
||||
r1, nErr := ss.Post().GetDirectPostParentsForExportAfter(10000, strings.Repeat("0", 26))
|
||||
assert.Nil(t, nErr)
|
||||
|
||||
assert.Equal(t, 0, len(r1))
|
||||
|
||||
|
||||
@@ -4275,7 +4275,7 @@ func (s *TimerLayerPluginStore) SetWithOptions(pluginId string, key string, valu
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.AnalyticsPostCount(teamId, mustHaveFile, mustHaveHashtag)
|
||||
@@ -4291,7 +4291,7 @@ func (s *TimerLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile boo
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.AnalyticsPostCountsByDay(options)
|
||||
@@ -4307,7 +4307,7 @@ func (s *TimerLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsP
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.AnalyticsUserCountsWithPostsByDay(teamId)
|
||||
@@ -4370,7 +4370,7 @@ func (s *TimerLayerPostStore) Get(id string, skipFetchThreads bool) (*model.Post
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetDirectPostParentsForExportAfter(limit, afterId)
|
||||
@@ -4466,7 +4466,7 @@ func (s *TimerLayerPostStore) GetMaxPostSize() int {
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetOldest() (*model.Post, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetOldest()
|
||||
@@ -4482,7 +4482,7 @@ func (s *TimerLayerPostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetOldestEntityCreationTime() (int64, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetOldestEntityCreationTime() (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetOldestEntityCreationTime()
|
||||
@@ -4498,7 +4498,7 @@ func (s *TimerLayerPostStore) GetOldestEntityCreationTime() (int64, *model.AppEr
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetParentsForExportAfter(limit, afterId)
|
||||
@@ -4562,7 +4562,7 @@ func (s *TimerLayerPostStore) GetPostIdBeforeTime(channelId string, time int64)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetPosts(options, allowFromCache)
|
||||
@@ -4594,7 +4594,7 @@ func (s *TimerLayerPostStore) GetPostsAfter(options model.GetPostsOptions) (*mod
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetPostsBatchForIndexing(startTime, endTime, limit)
|
||||
@@ -4626,7 +4626,7 @@ func (s *TimerLayerPostStore) GetPostsBefore(options model.GetPostsOptions) (*mo
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetPostsByIds(postIds)
|
||||
@@ -4642,7 +4642,7 @@ func (s *TimerLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, *m
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetPostsCreatedAt(channelId, time)
|
||||
@@ -4674,7 +4674,7 @@ func (s *TimerLayerPostStore) GetPostsSince(options model.GetPostsSinceOptions,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.GetRepliesForExport(parentId)
|
||||
@@ -4721,7 +4721,7 @@ func (s *TimerLayerPostStore) InvalidateLastPostTimeCache(channelId string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) Overwrite(post *model.Post) (*model.Post, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) Overwrite(post *model.Post) (*model.Post, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.Overwrite(post)
|
||||
@@ -4737,7 +4737,7 @@ func (s *TimerLayerPostStore) Overwrite(post *model.Post) (*model.Post, *model.A
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, resultVar1, err := s.PostStore.OverwriteMultiple(posts)
|
||||
@@ -4753,7 +4753,7 @@ func (s *TimerLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.P
|
||||
return result, resultVar1, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.PermanentDeleteBatch(endTime, limit)
|
||||
@@ -4833,7 +4833,7 @@ func (s *TimerLayerPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post,
|
||||
return result, resultVar1, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.Search(teamId, userId, params)
|
||||
@@ -4849,7 +4849,7 @@ func (s *TimerLayerPostStore) Search(teamId string, userId string, params *model
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, *model.AppError) {
|
||||
func (s *TimerLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.PostStore.SearchPostsInTeamForUser(paramsList, userId, teamId, page, perPage)
|
||||
|
||||
Ссылка в новой задаче
Block a user