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 +++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'store/sql_post_store.go') 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() { -- cgit v1.2.3-1-g7c22