diff options
author | JoramWilander <jwawilander@gmail.com> | 2016-02-25 12:32:46 -0500 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2016-03-01 10:46:30 -0500 |
commit | 8239c68cf323e4bb20007d2b456336becead273d (patch) | |
tree | 3422ed0946afafa47d6649e09f6f09ee71692363 /store/sql_team_store.go | |
parent | 8aa4e28932ec43090ca6b481929fafbe0119a660 (diff) | |
download | chat-8239c68cf323e4bb20007d2b456336becead273d.tar.gz chat-8239c68cf323e4bb20007d2b456336becead273d.tar.bz2 chat-8239c68cf323e4bb20007d2b456336becead273d.zip |
Refactor and modularize analytics on the client
Diffstat (limited to 'store/sql_team_store.go')
-rw-r--r-- | store/sql_team_store.go | 19 |
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 +} |