diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-09-08 11:55:37 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-09-08 11:55:37 -0400 |
commit | 05eb81638dba882b289ee39a34c6bc75e9f0941d (patch) | |
tree | 981e19a87bd0e6543a180ac91c2ad8a12b838f5c /store/sql_channel_store.go | |
parent | 1d692a0775b61886fd07147300ff70186554510c (diff) | |
parent | f0fd9a9e8b85544089246bde71b6d61ba90eeb0e (diff) | |
download | chat-05eb81638dba882b289ee39a34c6bc75e9f0941d.tar.gz chat-05eb81638dba882b289ee39a34c6bc75e9f0941d.tar.bz2 chat-05eb81638dba882b289ee39a34c6bc75e9f0941d.zip |
Merge pull request #602 from mattermost/mm-1409
MM-1409 Adding ability to export data from mattermost
Diffstat (limited to 'store/sql_channel_store.go')
-rw-r--r-- | store/sql_channel_store.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index d2e3943df..b58166fd6 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -678,3 +678,25 @@ func (s SqlChannelStore) UpdateNotifyLevel(channelId, userId, notifyLevel string return storeChannel } + +func (s SqlChannelStore) GetForExport(teamId string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + var data []*model.Channel + _, err := s.GetReplica().Select(&data, "SELECT * FROM Channels WHERE TeamId = :TeamId AND DeleteAt = 0 AND Type = 'O'", map[string]interface{}{"TeamId": teamId}) + + if err != nil { + result.Err = model.NewAppError("SqlChannelStore.GetAllChannels", "We couldn't get all the channels", "teamId="+teamId+", err="+err.Error()) + } else { + result.Data = data + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |