From aac8d121a00922f007b9c67d890ea9dbcfbe4b8f Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 20 Jan 2016 10:34:31 -0600 Subject: PLT-7 adding loc db calls for posts table --- store/sql_post_store.go | 53 ++++++----- store/sql_post_store_test.go | 222 +++++++++++++++++++++---------------------- store/store.go | 30 +++--- 3 files changed, 153 insertions(+), 152 deletions(-) (limited to 'store') diff --git a/store/sql_post_store.go b/store/sql_post_store.go index 40dca9930..b48406261 100644 --- a/store/sql_post_store.go +++ b/store/sql_post_store.go @@ -11,6 +11,7 @@ import ( "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" + goi18n "github.com/nicksnyder/go-i18n/i18n" ) type SqlPostStore struct { @@ -50,7 +51,7 @@ func (s SqlPostStore) CreateIndexesIfNotExists() { s.CreateFullTextIndexIfNotExists("idx_posts_hashtags_txt", "Posts", "Hashtags") } -func (s SqlPostStore) Save(post *model.Post) StoreChannel { +func (s SqlPostStore) Save(T goi18n.TranslateFunc, post *model.Post) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -97,7 +98,7 @@ func (s SqlPostStore) Save(post *model.Post) StoreChannel { return storeChannel } -func (s SqlPostStore) Update(oldPost *model.Post, newMessage string, newHashtags string) StoreChannel { +func (s SqlPostStore) Update(T goi18n.TranslateFunc, oldPost *model.Post, newMessage string, newHashtags string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -142,7 +143,7 @@ func (s SqlPostStore) Update(oldPost *model.Post, newMessage string, newHashtags return storeChannel } -func (s SqlPostStore) Get(id string) StoreChannel { +func (s SqlPostStore) Get(T goi18n.TranslateFunc, id string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -188,7 +189,7 @@ type etagPosts struct { UpdateAt int64 } -func (s SqlPostStore) GetEtag(channelId string) StoreChannel { +func (s SqlPostStore) GetEtag(T goi18n.TranslateFunc, channelId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -209,7 +210,7 @@ func (s SqlPostStore) GetEtag(channelId string) StoreChannel { return storeChannel } -func (s SqlPostStore) Delete(postId string, time int64) StoreChannel { +func (s SqlPostStore) Delete(T goi18n.TranslateFunc, postId string, time int64) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -227,7 +228,7 @@ func (s SqlPostStore) Delete(postId string, time int64) StoreChannel { return storeChannel } -func (s SqlPostStore) permanentDelete(postId string) StoreChannel { +func (s SqlPostStore) permanentDelete(T goi18n.TranslateFunc, postId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -245,7 +246,7 @@ func (s SqlPostStore) permanentDelete(postId string) StoreChannel { return storeChannel } -func (s SqlPostStore) permanentDeleteAllCommentByUser(userId string) StoreChannel { +func (s SqlPostStore) permanentDeleteAllCommentByUser(T goi18n.TranslateFunc, userId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -263,14 +264,14 @@ func (s SqlPostStore) permanentDeleteAllCommentByUser(userId string) StoreChanne return storeChannel } -func (s SqlPostStore) PermanentDeleteByUser(userId string) StoreChannel { +func (s SqlPostStore) PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel { storeChannel := make(StoreChannel) go func() { result := StoreResult{} // First attempt to delete all the comments for a user - if r := <-s.permanentDeleteAllCommentByUser(userId); r.Err != nil { + if r := <-s.permanentDeleteAllCommentByUser(T, userId); r.Err != nil { result.Err = r.Err storeChannel <- result close(storeChannel) @@ -294,7 +295,7 @@ func (s SqlPostStore) PermanentDeleteByUser(userId string) StoreChannel { found = false for _, id := range ids { found = true - if r := <-s.permanentDelete(id); r.Err != nil { + if r := <-s.permanentDelete(T, id); r.Err != nil { result.Err = r.Err storeChannel <- result close(storeChannel) @@ -320,7 +321,7 @@ func (s SqlPostStore) PermanentDeleteByUser(userId string) StoreChannel { return storeChannel } -func (s SqlPostStore) GetPosts(channelId string, offset int, limit int) StoreChannel { +func (s SqlPostStore) GetPosts(T goi18n.TranslateFunc, channelId string, offset int, limit int) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -333,8 +334,8 @@ func (s SqlPostStore) GetPosts(channelId string, offset int, limit int) StoreCha return } - rpc := s.getRootPosts(channelId, offset, limit) - cpc := s.getParentsPosts(channelId, offset, limit) + rpc := s.getRootPosts(T, channelId, offset, limit) + cpc := s.getParentsPosts(T, channelId, offset, limit) if rpr := <-rpc; rpr.Err != nil { result.Err = rpr.Err @@ -367,7 +368,7 @@ func (s SqlPostStore) GetPosts(channelId string, offset int, limit int) StoreCha return storeChannel } -func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel { +func (s SqlPostStore) GetPostsSince(T goi18n.TranslateFunc, channelId string, time int64) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -425,15 +426,15 @@ func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel { return storeChannel } -func (s SqlPostStore) GetPostsBefore(channelId string, postId string, numPosts int, offset int) StoreChannel { - return s.getPostsAround(channelId, postId, numPosts, offset, true) +func (s SqlPostStore) GetPostsBefore(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int) StoreChannel { + return s.getPostsAround(T, channelId, postId, numPosts, offset, true) } -func (s SqlPostStore) GetPostsAfter(channelId string, postId string, numPosts int, offset int) StoreChannel { - return s.getPostsAround(channelId, postId, numPosts, offset, false) +func (s SqlPostStore) GetPostsAfter(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int) StoreChannel { + return s.getPostsAround(T, channelId, postId, numPosts, offset, false) } -func (s SqlPostStore) getPostsAround(channelId string, postId string, numPosts int, offset int, before bool) StoreChannel { +func (s SqlPostStore) getPostsAround(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int, before bool) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -523,7 +524,7 @@ func (s SqlPostStore) getPostsAround(channelId string, postId string, numPosts i return storeChannel } -func (s SqlPostStore) getRootPosts(channelId string, offset int, limit int) StoreChannel { +func (s SqlPostStore) getRootPosts(T goi18n.TranslateFunc, channelId string, offset int, limit int) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -544,7 +545,7 @@ func (s SqlPostStore) getRootPosts(channelId string, offset int, limit int) Stor return storeChannel } -func (s SqlPostStore) getParentsPosts(channelId string, offset int, limit int) StoreChannel { +func (s SqlPostStore) getParentsPosts(T goi18n.TranslateFunc, channelId string, offset int, limit int) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -600,7 +601,7 @@ var specialSearchChar = []string{ "@", } -func (s SqlPostStore) Search(teamId string, userId string, params *model.SearchParams) StoreChannel { +func (s SqlPostStore) Search(T goi18n.TranslateFunc, teamId string, userId string, params *model.SearchParams) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -765,7 +766,7 @@ func (s SqlPostStore) Search(teamId string, userId string, params *model.SearchP return storeChannel } -func (s SqlPostStore) GetForExport(channelId string) StoreChannel { +func (s SqlPostStore) GetForExport(T goi18n.TranslateFunc, channelId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -789,7 +790,7 @@ func (s SqlPostStore) GetForExport(channelId string) StoreChannel { return storeChannel } -func (s SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) StoreChannel { +func (s SqlPostStore) AnalyticsUserCountsWithPostsByDay(T goi18n.TranslateFunc, teamId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -853,7 +854,7 @@ func (s SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) StoreChan return storeChannel } -func (s SqlPostStore) AnalyticsPostCountsByDay(teamId string) StoreChannel { +func (s SqlPostStore) AnalyticsPostCountsByDay(T goi18n.TranslateFunc, teamId string) StoreChannel { storeChannel := make(StoreChannel) go func() { @@ -918,7 +919,7 @@ func (s SqlPostStore) AnalyticsPostCountsByDay(teamId string) StoreChannel { return storeChannel } -func (s SqlPostStore) AnalyticsPostCount(teamId string) StoreChannel { +func (s SqlPostStore) AnalyticsPostCount(T goi18n.TranslateFunc, teamId string) StoreChannel { storeChannel := make(StoreChannel) go func() { diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go index 5f022becf..5144924be 100644 --- a/store/sql_post_store_test.go +++ b/store/sql_post_store_test.go @@ -20,11 +20,11 @@ func TestPostStoreSave(t *testing.T) { o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - if err := (<-store.Post().Save(&o1)).Err; err != nil { + if err := (<-store.Post().Save(utils.T, &o1)).Err; err != nil { t.Fatal("couldn't save item", err) } - if err := (<-store.Post().Save(&o1)).Err; err == nil { + if err := (<-store.Post().Save(utils.T, &o1)).Err; err == nil { t.Fatal("shouldn't be able to update from save") } } @@ -37,19 +37,19 @@ func TestPostStoreGet(t *testing.T) { o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - etag1 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string) + etag1 := (<-store.Post().GetEtag(utils.T, o1.ChannelId)).Data.(string) if strings.Index(etag1, model.CurrentVersion+".0.") != 0 { t.Fatal("Invalid Etag") } - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) - etag2 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string) + etag2 := (<-store.Post().GetEtag(utils.T, o1.ChannelId)).Data.(string) if strings.Index(etag2, model.CurrentVersion+"."+o1.Id) != 0 { t.Fatal("Invalid Etag") } - if r1 := <-store.Post().Get(o1.Id); r1.Err != nil { + if r1 := <-store.Post().Get(utils.T, o1.Id); r1.Err != nil { t.Fatal(r1.Err) } else { if r1.Data.(*model.PostList).Posts[o1.Id].CreateAt != o1.CreateAt { @@ -57,7 +57,7 @@ func TestPostStoreGet(t *testing.T) { } } - if err := (<-store.Post().Get("123")).Err; err == nil { + if err := (<-store.Post().Get(utils.T, "123")).Err; err == nil { t.Fatal("Missing id should have failed") } } @@ -69,7 +69,7 @@ func TestPostStoreUpdate(t *testing.T) { o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "AAAAAAAAAAA" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) o2 := &model.Post{} o2.ChannelId = o1.ChannelId @@ -77,50 +77,50 @@ func TestPostStoreUpdate(t *testing.T) { o2.Message = "a" + model.NewId() + "CCCCCCCCC" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) o3 := &model.Post{} o3.ChannelId = o1.ChannelId o3.UserId = model.NewId() o3.Message = "a" + model.NewId() + "QQQQQQQQQQ" - o3 = (<-store.Post().Save(o3)).Data.(*model.Post) + o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post) - ro1 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o1.Id] - ro2 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o2.Id] - ro6 := (<-store.Post().Get(o3.Id)).Data.(*model.PostList).Posts[o3.Id] + ro1 := (<-store.Post().Get(utils.T, o1.Id)).Data.(*model.PostList).Posts[o1.Id] + ro2 := (<-store.Post().Get(utils.T, o1.Id)).Data.(*model.PostList).Posts[o2.Id] + ro6 := (<-store.Post().Get(utils.T, o3.Id)).Data.(*model.PostList).Posts[o3.Id] if ro1.Message != o1.Message { t.Fatal("Failed to save/get") } msg := o1.Message + "BBBBBBBBBB" - if result := <-store.Post().Update(ro1, msg, ""); result.Err != nil { + if result := <-store.Post().Update(utils.T, ro1, msg, ""); result.Err != nil { t.Fatal(result.Err) } msg2 := o2.Message + "DDDDDDD" - if result := <-store.Post().Update(ro2, msg2, ""); result.Err != nil { + if result := <-store.Post().Update(utils.T, ro2, msg2, ""); result.Err != nil { t.Fatal(result.Err) } msg3 := o3.Message + "WWWWWWW" - if result := <-store.Post().Update(ro6, msg3, "#hashtag"); result.Err != nil { + if result := <-store.Post().Update(utils.T, ro6, msg3, "#hashtag"); result.Err != nil { t.Fatal(result.Err) } - ro3 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o1.Id] + ro3 := (<-store.Post().Get(utils.T, o1.Id)).Data.(*model.PostList).Posts[o1.Id] if ro3.Message != msg { t.Fatal("Failed to update/get") } - ro4 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o2.Id] + ro4 := (<-store.Post().Get(utils.T, o1.Id)).Data.(*model.PostList).Posts[o2.Id] if ro4.Message != msg2 { t.Fatal("Failed to update/get") } - ro5 := (<-store.Post().Get(o3.Id)).Data.(*model.PostList).Posts[o3.Id] + ro5 := (<-store.Post().Get(utils.T, o3.Id)).Data.(*model.PostList).Posts[o3.Id] if ro5.Message != msg3 && ro5.Hashtags != "#hashtag" { t.Fatal("Failed to update/get") @@ -136,14 +136,14 @@ func TestPostStoreDelete(t *testing.T) { o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - etag1 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string) + etag1 := (<-store.Post().GetEtag(utils.T, o1.ChannelId)).Data.(string) if strings.Index(etag1, model.CurrentVersion+".0.") != 0 { t.Fatal("Invalid Etag") } - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) - if r1 := <-store.Post().Get(o1.Id); r1.Err != nil { + if r1 := <-store.Post().Get(utils.T, o1.Id); r1.Err != nil { t.Fatal(r1.Err) } else { if r1.Data.(*model.PostList).Posts[o1.Id].CreateAt != o1.CreateAt { @@ -151,16 +151,16 @@ func TestPostStoreDelete(t *testing.T) { } } - if r2 := <-store.Post().Delete(o1.Id, model.GetMillis()); r2.Err != nil { + if r2 := <-store.Post().Delete(utils.T, o1.Id, model.GetMillis()); r2.Err != nil { t.Fatal(r2.Err) } - if r3 := (<-store.Post().Get(o1.Id)); r3.Err == nil { + if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err == nil { t.Log(r3.Data) t.Fatal("Missing id should have failed") } - etag2 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string) + etag2 := (<-store.Post().GetEtag(utils.T, o1.ChannelId)).Data.(string) if strings.Index(etag2, model.CurrentVersion+"."+o1.Id) != 0 { t.Fatal("Invalid Etag") } @@ -173,7 +173,7 @@ func TestPostStoreDelete1Level(t *testing.T) { o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) o2 := &model.Post{} o2.ChannelId = o1.ChannelId @@ -181,17 +181,17 @@ func TestPostStoreDelete1Level(t *testing.T) { o2.Message = "a" + model.NewId() + "b" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) - if r2 := <-store.Post().Delete(o1.Id, model.GetMillis()); r2.Err != nil { + if r2 := <-store.Post().Delete(utils.T, o1.Id, model.GetMillis()); r2.Err != nil { t.Fatal(r2.Err) } - if r3 := (<-store.Post().Get(o1.Id)); r3.Err == nil { + if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err == nil { t.Fatal("Deleted id should have failed") } - if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil { + if r4 := (<-store.Post().Get(utils.T, o2.Id)); r4.Err == nil { t.Fatal("Deleted id should have failed") } } @@ -203,7 +203,7 @@ func TestPostStoreDelete2Level(t *testing.T) { o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) o2 := &model.Post{} o2.ChannelId = o1.ChannelId @@ -211,7 +211,7 @@ func TestPostStoreDelete2Level(t *testing.T) { o2.Message = "a" + model.NewId() + "b" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) o3 := &model.Post{} o3.ChannelId = o1.ChannelId @@ -219,31 +219,31 @@ func TestPostStoreDelete2Level(t *testing.T) { o3.Message = "a" + model.NewId() + "b" o3.ParentId = o2.Id o3.RootId = o1.Id - o3 = (<-store.Post().Save(o3)).Data.(*model.Post) + o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post) o4 := &model.Post{} o4.ChannelId = model.NewId() o4.UserId = model.NewId() o4.Message = "a" + model.NewId() + "b" - o4 = (<-store.Post().Save(o4)).Data.(*model.Post) + o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post) - if r2 := <-store.Post().Delete(o1.Id, model.GetMillis()); r2.Err != nil { + if r2 := <-store.Post().Delete(utils.T, o1.Id, model.GetMillis()); r2.Err != nil { t.Fatal(r2.Err) } - if r3 := (<-store.Post().Get(o1.Id)); r3.Err == nil { + if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err == nil { t.Fatal("Deleted id should have failed") } - if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil { + if r4 := (<-store.Post().Get(utils.T, o2.Id)); r4.Err == nil { t.Fatal("Deleted id should have failed") } - if r5 := (<-store.Post().Get(o3.Id)); r5.Err == nil { + if r5 := (<-store.Post().Get(utils.T, o3.Id)); r5.Err == nil { t.Fatal("Deleted id should have failed") } - if r6 := <-store.Post().Get(o4.Id); r6.Err != nil { + if r6 := <-store.Post().Get(utils.T, o4.Id); r6.Err != nil { t.Fatal(r6.Err) } } @@ -255,7 +255,7 @@ func TestPostStorePermDelete1Level(t *testing.T) { o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) o2 := &model.Post{} o2.ChannelId = o1.ChannelId @@ -263,17 +263,17 @@ func TestPostStorePermDelete1Level(t *testing.T) { o2.Message = "a" + model.NewId() + "b" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) - if r2 := <-store.Post().PermanentDeleteByUser(o2.UserId); r2.Err != nil { + if r2 := <-store.Post().PermanentDeleteByUser(utils.T, o2.UserId); r2.Err != nil { t.Fatal(r2.Err) } - if r3 := (<-store.Post().Get(o1.Id)); r3.Err != nil { + if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err != nil { t.Fatal("Deleted id shouldn't have failed") } - if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil { + if r4 := (<-store.Post().Get(utils.T, o2.Id)); r4.Err == nil { t.Fatal("Deleted id should have failed") } } @@ -285,7 +285,7 @@ func TestPostStorePermDelete1Level2(t *testing.T) { o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) o2 := &model.Post{} o2.ChannelId = o1.ChannelId @@ -293,27 +293,27 @@ func TestPostStorePermDelete1Level2(t *testing.T) { o2.Message = "a" + model.NewId() + "b" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) o3 := &model.Post{} o3.ChannelId = model.NewId() o3.UserId = model.NewId() o3.Message = "a" + model.NewId() + "b" - o3 = (<-store.Post().Save(o3)).Data.(*model.Post) + o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post) - if r2 := <-store.Post().PermanentDeleteByUser(o1.UserId); r2.Err != nil { + if r2 := <-store.Post().PermanentDeleteByUser(utils.T, o1.UserId); r2.Err != nil { t.Fatal(r2.Err) } - if r3 := (<-store.Post().Get(o1.Id)); r3.Err == nil { + if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err == nil { t.Fatal("Deleted id should have failed") } - if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil { + if r4 := (<-store.Post().Get(utils.T, o2.Id)); r4.Err == nil { t.Fatal("Deleted id should have failed") } - if r5 := (<-store.Post().Get(o3.Id)); r5.Err != nil { + if r5 := (<-store.Post().Get(utils.T, o3.Id)); r5.Err != nil { t.Fatal("Deleted id shouldn't have failed") } } @@ -325,7 +325,7 @@ func TestPostStoreGetWithChildren(t *testing.T) { o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) o2 := &model.Post{} o2.ChannelId = o1.ChannelId @@ -333,7 +333,7 @@ func TestPostStoreGetWithChildren(t *testing.T) { o2.Message = "a" + model.NewId() + "b" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) o3 := &model.Post{} o3.ChannelId = o1.ChannelId @@ -341,9 +341,9 @@ func TestPostStoreGetWithChildren(t *testing.T) { o3.Message = "a" + model.NewId() + "b" o3.ParentId = o2.Id o3.RootId = o1.Id - o3 = (<-store.Post().Save(o3)).Data.(*model.Post) + o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post) - if r1 := <-store.Post().Get(o1.Id); r1.Err != nil { + if r1 := <-store.Post().Get(utils.T, o1.Id); r1.Err != nil { t.Fatal(r1.Err) } else { pl := r1.Data.(*model.PostList) @@ -352,9 +352,9 @@ func TestPostStoreGetWithChildren(t *testing.T) { } } - Must(store.Post().Delete(o3.Id, model.GetMillis())) + Must(store.Post().Delete(utils.T, o3.Id, model.GetMillis())) - if r2 := <-store.Post().Get(o1.Id); r2.Err != nil { + if r2 := <-store.Post().Get(utils.T, o1.Id); r2.Err != nil { t.Fatal(r2.Err) } else { pl := r2.Data.(*model.PostList) @@ -363,9 +363,9 @@ func TestPostStoreGetWithChildren(t *testing.T) { } } - Must(store.Post().Delete(o2.Id, model.GetMillis())) + Must(store.Post().Delete(utils.T, o2.Id, model.GetMillis())) - if r3 := <-store.Post().Get(o1.Id); r3.Err != nil { + if r3 := <-store.Post().Get(utils.T, o1.Id); r3.Err != nil { t.Fatal(r3.Err) } else { pl := r3.Data.(*model.PostList) @@ -382,7 +382,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) { o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o2 := &model.Post{} @@ -391,7 +391,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) { o2.Message = "a" + model.NewId() + "b" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o2a := &model.Post{} @@ -400,7 +400,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) { o2a.Message = "a" + model.NewId() + "b" o2a.ParentId = o1.Id o2a.RootId = o1.Id - o2a = (<-store.Post().Save(o2a)).Data.(*model.Post) + o2a = (<-store.Post().Save(utils.T, o2a)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o3 := &model.Post{} @@ -409,14 +409,14 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) { o3.Message = "a" + model.NewId() + "b" o3.ParentId = o1.Id o3.RootId = o1.Id - o3 = (<-store.Post().Save(o3)).Data.(*model.Post) + o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o4 := &model.Post{} o4.ChannelId = o1.ChannelId o4.UserId = model.NewId() o4.Message = "a" + model.NewId() + "b" - o4 = (<-store.Post().Save(o4)).Data.(*model.Post) + o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o5 := &model.Post{} @@ -425,9 +425,9 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) { o5.Message = "a" + model.NewId() + "b" o5.ParentId = o4.Id o5.RootId = o4.Id - o5 = (<-store.Post().Save(o5)).Data.(*model.Post) + o5 = (<-store.Post().Save(utils.T, o5)).Data.(*model.Post) - r1 := (<-store.Post().GetPosts(o1.ChannelId, 0, 4)).Data.(*model.PostList) + r1 := (<-store.Post().GetPosts(utils.T, o1.ChannelId, 0, 4)).Data.(*model.PostList) if r1.Order[0] != o5.Id { t.Fatal("invalid order") @@ -460,14 +460,14 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) { o0.ChannelId = model.NewId() o0.UserId = model.NewId() o0.Message = "a" + model.NewId() + "b" - o0 = (<-store.Post().Save(o0)).Data.(*model.Post) + o0 = (<-store.Post().Save(utils.T, o0)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o1 := &model.Post{} o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o2 := &model.Post{} @@ -476,7 +476,7 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) { o2.Message = "a" + model.NewId() + "b" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o2a := &model.Post{} @@ -485,7 +485,7 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) { o2a.Message = "a" + model.NewId() + "b" o2a.ParentId = o1.Id o2a.RootId = o1.Id - o2a = (<-store.Post().Save(o2a)).Data.(*model.Post) + o2a = (<-store.Post().Save(utils.T, o2a)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o3 := &model.Post{} @@ -494,14 +494,14 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) { o3.Message = "a" + model.NewId() + "b" o3.ParentId = o1.Id o3.RootId = o1.Id - o3 = (<-store.Post().Save(o3)).Data.(*model.Post) + o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o4 := &model.Post{} o4.ChannelId = o1.ChannelId o4.UserId = model.NewId() o4.Message = "a" + model.NewId() + "b" - o4 = (<-store.Post().Save(o4)).Data.(*model.Post) + o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o5 := &model.Post{} @@ -510,15 +510,15 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) { o5.Message = "a" + model.NewId() + "b" o5.ParentId = o4.Id o5.RootId = o4.Id - o5 = (<-store.Post().Save(o5)).Data.(*model.Post) + o5 = (<-store.Post().Save(utils.T, o5)).Data.(*model.Post) - r1 := (<-store.Post().GetPostsBefore(o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList) + r1 := (<-store.Post().GetPostsBefore(utils.T, o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList) if len(r1.Posts) != 0 { t.Fatal("Wrong size") } - r2 := (<-store.Post().GetPostsAfter(o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList) + r2 := (<-store.Post().GetPostsAfter(utils.T, o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList) if r2.Order[0] != o4.Id { t.Fatal("invalid order") @@ -540,7 +540,7 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) { t.Fatal("wrong size") } - r3 := (<-store.Post().GetPostsBefore(o3.ChannelId, o3.Id, 2, 0)).Data.(*model.PostList) + r3 := (<-store.Post().GetPostsBefore(utils.T, o3.ChannelId, o3.Id, 2, 0)).Data.(*model.PostList) if r3.Order[0] != o2a.Id { t.Fatal("invalid order") @@ -565,14 +565,14 @@ func TestPostStoreGetPostsSince(t *testing.T) { o0.ChannelId = model.NewId() o0.UserId = model.NewId() o0.Message = "a" + model.NewId() + "b" - o0 = (<-store.Post().Save(o0)).Data.(*model.Post) + o0 = (<-store.Post().Save(utils.T, o0)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o1 := &model.Post{} o1.ChannelId = model.NewId() o1.UserId = model.NewId() o1.Message = "a" + model.NewId() + "b" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o2 := &model.Post{} @@ -581,7 +581,7 @@ func TestPostStoreGetPostsSince(t *testing.T) { o2.Message = "a" + model.NewId() + "b" o2.ParentId = o1.Id o2.RootId = o1.Id - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o2a := &model.Post{} @@ -590,7 +590,7 @@ func TestPostStoreGetPostsSince(t *testing.T) { o2a.Message = "a" + model.NewId() + "b" o2a.ParentId = o1.Id o2a.RootId = o1.Id - o2a = (<-store.Post().Save(o2a)).Data.(*model.Post) + o2a = (<-store.Post().Save(utils.T, o2a)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o3 := &model.Post{} @@ -599,14 +599,14 @@ func TestPostStoreGetPostsSince(t *testing.T) { o3.Message = "a" + model.NewId() + "b" o3.ParentId = o1.Id o3.RootId = o1.Id - o3 = (<-store.Post().Save(o3)).Data.(*model.Post) + o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o4 := &model.Post{} o4.ChannelId = o1.ChannelId o4.UserId = model.NewId() o4.Message = "a" + model.NewId() + "b" - o4 = (<-store.Post().Save(o4)).Data.(*model.Post) + o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post) time.Sleep(2 * time.Millisecond) o5 := &model.Post{} @@ -615,9 +615,9 @@ func TestPostStoreGetPostsSince(t *testing.T) { o5.Message = "a" + model.NewId() + "b" o5.ParentId = o4.Id o5.RootId = o4.Id - o5 = (<-store.Post().Save(o5)).Data.(*model.Post) + o5 = (<-store.Post().Save(utils.T, o5)).Data.(*model.Post) - r1 := (<-store.Post().GetPostsSince(o1.ChannelId, o1.CreateAt)).Data.(*model.PostList) + r1 := (<-store.Post().GetPostsSince(utils.T, o1.ChannelId, o1.CreateAt)).Data.(*model.PostList) if r1.Order[0] != o5.Id { t.Fatal("invalid order") @@ -674,84 +674,84 @@ func TestPostStoreSearch(t *testing.T) { o1.ChannelId = c1.Id o1.UserId = model.NewId() o1.Message = "corey mattermost new york" - o1 = (<-store.Post().Save(o1)).Data.(*model.Post) + o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post) o2 := &model.Post{} o2.ChannelId = c1.Id o2.UserId = model.NewId() o2.Message = "New Jersey is where John is from" - o2 = (<-store.Post().Save(o2)).Data.(*model.Post) + o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post) o3 := &model.Post{} o3.ChannelId = c2.Id o3.UserId = model.NewId() o3.Message = "New Jersey is where John is from corey new york" - o3 = (<-store.Post().Save(o3)).Data.(*model.Post) + o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post) o4 := &model.Post{} o4.ChannelId = c1.Id o4.UserId = model.NewId() o4.Hashtags = "#hashtag" o4.Message = "(message)blargh" - o4 = (<-store.Post().Save(o4)).Data.(*model.Post) + o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post) o5 := &model.Post{} o5.ChannelId = c1.Id o5.UserId = model.NewId() o5.Hashtags = "#secret #howdy" - o5 = (<-store.Post().Save(o5)).Data.(*model.Post) + o5 = (<-store.Post().Save(utils.T, o5)).Data.(*model.Post) - r1 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "corey", IsHashtag: false})).Data.(*model.PostList) + r1 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "corey", IsHashtag: false})).Data.(*model.PostList) if len(r1.Order) != 1 || r1.Order[0] != o1.Id { t.Fatal("returned wrong search result") } - r3 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "new", IsHashtag: false})).Data.(*model.PostList) + r3 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "new", IsHashtag: false})).Data.(*model.PostList) if len(r3.Order) != 2 || (r3.Order[0] != o1.Id && r3.Order[1] != o1.Id) { t.Fatal("returned wrong search result") } - r4 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "john", IsHashtag: false})).Data.(*model.PostList) + r4 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "john", IsHashtag: false})).Data.(*model.PostList) if len(r4.Order) != 1 || r4.Order[0] != o2.Id { t.Fatal("returned wrong search result") } - r5 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "matter*", IsHashtag: false})).Data.(*model.PostList) + r5 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "matter*", IsHashtag: false})).Data.(*model.PostList) if len(r5.Order) != 1 || r5.Order[0] != o1.Id { t.Fatal("returned wrong search result") } - r6 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "#hashtag", IsHashtag: true})).Data.(*model.PostList) + r6 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "#hashtag", IsHashtag: true})).Data.(*model.PostList) if len(r6.Order) != 1 || r6.Order[0] != o4.Id { t.Fatal("returned wrong search result") } - r7 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "#secret", IsHashtag: true})).Data.(*model.PostList) + r7 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "#secret", IsHashtag: true})).Data.(*model.PostList) if len(r7.Order) != 1 || r7.Order[0] != o5.Id { t.Fatal("returned wrong search result") } - r8 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "@thisshouldmatchnothing", IsHashtag: true})).Data.(*model.PostList) + r8 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "@thisshouldmatchnothing", IsHashtag: true})).Data.(*model.PostList) if len(r8.Order) != 0 { t.Fatal("returned wrong search result") } - r9 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "mattermost jersey", IsHashtag: false})).Data.(*model.PostList) + r9 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "mattermost jersey", IsHashtag: false})).Data.(*model.PostList) if len(r9.Order) != 2 { t.Fatal("returned wrong search result") } - r10 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "matter* jer*", IsHashtag: false})).Data.(*model.PostList) + r10 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "matter* jer*", IsHashtag: false})).Data.(*model.PostList) if len(r10.Order) != 2 { t.Fatal("returned wrong search result") } - r11 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "message blargh", IsHashtag: false})).Data.(*model.PostList) + r11 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "message blargh", IsHashtag: false})).Data.(*model.PostList) if len(r11.Order) != 1 { t.Fatal("returned wrong search result") } - r12 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "blargh>", IsHashtag: false})).Data.(*model.PostList) + r12 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "blargh>", IsHashtag: false})).Data.(*model.PostList) if len(r12.Order) != 1 { t.Fatal("returned wrong search result") } @@ -779,30 +779,30 @@ func TestUserCountsWithPostsByDay(t *testing.T) { o1.UserId = model.NewId() o1.CreateAt = utils.MillisFromTime(utils.Yesterday()) o1.Message = "a" + model.NewId() + "b" - o1 = Must(store.Post().Save(o1)).(*model.Post) + o1 = Must(store.Post().Save(utils.T, o1)).(*model.Post) o1a := &model.Post{} o1a.ChannelId = c1.Id o1a.UserId = model.NewId() o1a.CreateAt = o1.CreateAt o1a.Message = "a" + model.NewId() + "b" - o1a = Must(store.Post().Save(o1a)).(*model.Post) + o1a = Must(store.Post().Save(utils.T, o1a)).(*model.Post) o2 := &model.Post{} o2.ChannelId = c1.Id o2.UserId = model.NewId() o2.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24) o2.Message = "a" + model.NewId() + "b" - o2 = Must(store.Post().Save(o2)).(*model.Post) + o2 = Must(store.Post().Save(utils.T, o2)).(*model.Post) o2a := &model.Post{} o2a.ChannelId = c1.Id o2a.UserId = o2.UserId o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24) o2a.Message = "a" + model.NewId() + "b" - o2a = Must(store.Post().Save(o2a)).(*model.Post) + o2a = Must(store.Post().Save(utils.T, o2a)).(*model.Post) - if r1 := <-store.Post().AnalyticsUserCountsWithPostsByDay(t1.Id); r1.Err != nil { + if r1 := <-store.Post().AnalyticsUserCountsWithPostsByDay(utils.T, t1.Id); r1.Err != nil { t.Fatal(r1.Err) } else { row1 := r1.Data.(model.AnalyticsRows)[0] @@ -839,33 +839,33 @@ func TestPostCountsByDay(t *testing.T) { o1.UserId = model.NewId() o1.CreateAt = utils.MillisFromTime(utils.Yesterday()) o1.Message = "a" + model.NewId() + "b" - o1 = Must(store.Post().Save(o1)).(*model.Post) + o1 = Must(store.Post().Save(utils.T, o1)).(*model.Post) o1a := &model.Post{} o1a.ChannelId = c1.Id o1a.UserId = model.NewId() o1a.CreateAt = o1.CreateAt o1a.Message = "a" + model.NewId() + "b" - o1a = Must(store.Post().Save(o1a)).(*model.Post) + o1a = Must(store.Post().Save(utils.T, o1a)).(*model.Post) o2 := &model.Post{} o2.ChannelId = c1.Id o2.UserId = model.NewId() o2.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2) o2.Message = "a" + model.NewId() + "b" - o2 = Must(store.Post().Save(o2)).(*model.Post) + o2 = Must(store.Post().Save(utils.T, o2)).(*model.Post) o2a := &model.Post{} o2a.ChannelId = c1.Id o2a.UserId = o2.UserId o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2) o2a.Message = "a" + model.NewId() + "b" - o2a = Must(store.Post().Save(o2a)).(*model.Post) + o2a = Must(store.Post().Save(utils.T, o2a)).(*model.Post) time.Sleep(1 * time.Second) t.Log(t1.Id) - if r1 := <-store.Post().AnalyticsPostCountsByDay(t1.Id); r1.Err != nil { + if r1 := <-store.Post().AnalyticsPostCountsByDay(utils.T, t1.Id); r1.Err != nil { t.Fatal(r1.Err) } else { row1 := r1.Data.(model.AnalyticsRows)[0] @@ -880,7 +880,7 @@ func TestPostCountsByDay(t *testing.T) { } } - if r1 := <-store.Post().AnalyticsPostCount(t1.Id); r1.Err != nil { + if r1 := <-store.Post().AnalyticsPostCount(utils.T, t1.Id); r1.Err != nil { t.Fatal(r1.Err) } else { if r1.Data.(int64) != 4 { diff --git a/store/store.go b/store/store.go index c6e3d1273..bd840a87d 100644 --- a/store/store.go +++ b/store/store.go @@ -88,21 +88,21 @@ type ChannelStore interface { } type PostStore interface { - Save(post *model.Post) StoreChannel - Update(post *model.Post, newMessage string, newHashtags string) StoreChannel - Get(id string) StoreChannel - Delete(postId string, time int64) StoreChannel - PermanentDeleteByUser(userId string) StoreChannel - GetPosts(channelId string, offset int, limit int) StoreChannel - GetPostsBefore(channelId string, postId string, numPosts int, offset int) StoreChannel - GetPostsAfter(channelId string, postId string, numPosts int, offset int) StoreChannel - GetPostsSince(channelId string, time int64) StoreChannel - GetEtag(channelId string) StoreChannel - Search(teamId string, userId string, params *model.SearchParams) StoreChannel - GetForExport(channelId string) StoreChannel - AnalyticsUserCountsWithPostsByDay(teamId string) StoreChannel - AnalyticsPostCountsByDay(teamId string) StoreChannel - AnalyticsPostCount(teamId string) StoreChannel + Save(T goi18n.TranslateFunc, post *model.Post) StoreChannel + Update(T goi18n.TranslateFunc, post *model.Post, newMessage string, newHashtags string) StoreChannel + Get(T goi18n.TranslateFunc, id string) StoreChannel + Delete(T goi18n.TranslateFunc, postId string, time int64) StoreChannel + PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel + GetPosts(T goi18n.TranslateFunc, channelId string, offset int, limit int) StoreChannel + GetPostsBefore(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int) StoreChannel + GetPostsAfter(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int) StoreChannel + GetPostsSince(T goi18n.TranslateFunc, channelId string, time int64) StoreChannel + GetEtag(T goi18n.TranslateFunc, channelId string) StoreChannel + Search(T goi18n.TranslateFunc, teamId string, userId string, params *model.SearchParams) StoreChannel + GetForExport(T goi18n.TranslateFunc, channelId string) StoreChannel + AnalyticsUserCountsWithPostsByDay(T goi18n.TranslateFunc, teamId string) StoreChannel + AnalyticsPostCountsByDay(T goi18n.TranslateFunc, teamId string) StoreChannel + AnalyticsPostCount(T goi18n.TranslateFunc, teamId string) StoreChannel } type UserStore interface { -- cgit v1.2.3-1-g7c22