summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-09-10 15:15:04 -0700
committer=Corey Hulen <corey@hulen.com>2015-09-10 15:15:04 -0700
commit83b04181da84d0456dfa02b8d52953eb3fd3d7d1 (patch)
tree49510d8a6d4be6aeed9a86816cffcbc82d66b09b /store/sql_post_store.go
parent1108ac53063bedcfe00647fa0577e91cf60555de (diff)
parent927b474005b9e6c03f7385f4d1a06626dd0450e3 (diff)
downloadchat-83b04181da84d0456dfa02b8d52953eb3fd3d7d1.tar.gz
chat-83b04181da84d0456dfa02b8d52953eb3fd3d7d1.tar.bz2
chat-83b04181da84d0456dfa02b8d52953eb3fd3d7d1.zip
merging
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r--store/sql_post_store.go24
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
+}