diff options
author | Asaad Mahmood <Unknowngi@live.com> | 2015-09-09 10:56:48 +0500 |
---|---|---|
committer | Asaad Mahmood <Unknowngi@live.com> | 2015-09-09 10:56:48 +0500 |
commit | c7692a800ef43b63866b6f470b72eb1c3816484f (patch) | |
tree | 801314957491080f83789335f64fb979292529d9 /store/sql_post_store.go | |
parent | 8c9c6de97041f8b2d646a7b4f03852c74e8e8fab (diff) | |
parent | 64d4890a4109618b383f7cfe1acc541bd72a0899 (diff) | |
download | chat-c7692a800ef43b63866b6f470b72eb1c3816484f.tar.gz chat-c7692a800ef43b63866b6f470b72eb1c3816484f.tar.bz2 chat-c7692a800ef43b63866b6f470b72eb1c3816484f.zip |
Merge branch 'master' of https://github.com/mattermost/platform into ui-changes
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r-- | store/sql_post_store.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go index 297d60397..20de23eb7 100644 --- a/store/sql_post_store.go +++ b/store/sql_post_store.go @@ -506,3 +506,27 @@ func (s SqlPostStore) Search(teamId string, userId string, terms string, isHasht return storeChannel } + +func (s SqlPostStore) GetForExport(channelId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + var posts []*model.Post + _, err := s.GetReplica().Select( + &posts, + "SELECT * FROM Posts WHERE ChannelId = :ChannelId AND DeleteAt = 0", + map[string]interface{}{"ChannelId": channelId}) + if err != nil { + result.Err = model.NewAppError("SqlPostStore.GetForExport", "We couldn't get the posts for the channel", "channelId="+channelId+err.Error()) + } else { + result.Data = posts + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |