summaryrefslogtreecommitdiffstats
path: root/store/sql_team_store.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-03-02 12:22:11 -0800
committerCorey Hulen <corey@hulen.com>2016-03-02 12:22:11 -0800
commitc52153bf601cee5bc21e9e79efcd1fdd5ef1dac7 (patch)
tree822f5614a031f8d65c3ddca7e3e3dfec1152e053 /store/sql_team_store.go
parentcddc9df7c4371e4240d65c6874155e1ce85adff0 (diff)
parentfbb71cab4b4c0289c1f071f9fa2e61b0b0237ece (diff)
downloadchat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.tar.gz
chat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.tar.bz2
chat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.zip
Merge pull request #2258 from mattermost/plt-1796
PLT-1796 Refactor and modularize analytics on the client
Diffstat (limited to 'store/sql_team_store.go')
-rw-r--r--store/sql_team_store.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/store/sql_team_store.go b/store/sql_team_store.go
index 86ab9ac04..1893268c8 100644
--- a/store/sql_team_store.go
+++ b/store/sql_team_store.go
@@ -317,3 +317,22 @@ func (s SqlTeamStore) PermanentDelete(teamId string) StoreChannel {
return storeChannel
}
+
+func (s SqlTeamStore) AnalyticsTeamCount() StoreChannel {
+ storeChannel := make(StoreChannel)
+
+ go func() {
+ result := StoreResult{}
+
+ if c, err := s.GetReplica().SelectInt("SELECT COUNT(*) FROM Teams WHERE DeleteAt = 0", map[string]interface{}{}); err != nil {
+ result.Err = model.NewLocAppError("SqlTeamStore.AnalyticsTeamCount", "store.sql_team.analytics_team_count.app_error", nil, err.Error())
+ } else {
+ result.Data = c
+ }
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}