diff options
author | Corey Hulen <corey@hulen.com> | 2015-10-27 11:40:49 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-10-27 11:40:49 -0700 |
commit | e0f69060fa462390779dd7b4cf6b67a12c3974ba (patch) | |
tree | b1ea3f745c2607a0f12eaa0af18db3c4c846ab63 /store/sql_channel_store.go | |
parent | 4dbde3e1d8f6c6a7087c6af1407140a7b250c8d0 (diff) | |
parent | 399e9c6f4bbed7f9eac0a75242ec75e4b0d2bb59 (diff) | |
download | chat-e0f69060fa462390779dd7b4cf6b67a12c3974ba.tar.gz chat-e0f69060fa462390779dd7b4cf6b67a12c3974ba.tar.bz2 chat-e0f69060fa462390779dd7b4cf6b67a12c3974ba.zip |
Merge pull request #1190 from mattermost/PLT-25
PLT-25 adding stats to admin console
Diffstat (limited to 'store/sql_channel_store.go')
-rw-r--r-- | store/sql_channel_store.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index 07e8e0151..80fe75130 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -828,3 +828,31 @@ func (s SqlChannelStore) GetForExport(teamId string) StoreChannel { return storeChannel } + +func (s SqlChannelStore) AnalyticsTypeCount(teamId string, channelType string) StoreChannel { + storeChannel := make(StoreChannel) + + go func() { + result := StoreResult{} + + v, err := s.GetReplica().SelectInt( + `SELECT + COUNT(Id) AS Value + FROM + Channels + WHERE + TeamId = :TeamId + AND Type = :ChannelType`, + map[string]interface{}{"TeamId": teamId, "ChannelType": channelType}) + if err != nil { + result.Err = model.NewAppError("SqlChannelStore.AnalyticsTypeCount", "We couldn't get channel type counts", err.Error()) + } else { + result.Data = v + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |