diff options
author | George Goldberg <george@gberg.me> | 2017-02-24 17:33:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-24 17:33:59 +0000 |
commit | f182d196fffc9da89ad63bdbd7bbb2e41da3146e (patch) | |
tree | 45d8aaad6ffc335dd40db225f2775d3204fcc812 /store/sql_channel_store.go | |
parent | ba028ed74b69bd1dd902344663fbf8ba4f1dfb87 (diff) | |
download | chat-f182d196fffc9da89ad63bdbd7bbb2e41da3146e.tar.gz chat-f182d196fffc9da89ad63bdbd7bbb2e41da3146e.tar.bz2 chat-f182d196fffc9da89ad63bdbd7bbb2e41da3146e.zip |
PLT-5070: Server side component of Telemetry. (#5514)
Diffstat (limited to 'store/sql_channel_store.go')
-rw-r--r-- | store/sql_channel_store.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index e7501ae69..068692074 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -1362,6 +1362,32 @@ func (s SqlChannelStore) AnalyticsTypeCount(teamId string, channelType string) S return storeChannel } +func (s SqlChannelStore) AnalyticsDeletedTypeCount(teamId string, channelType string) StoreChannel { + storeChannel := make(StoreChannel, 1) + + go func() { + result := StoreResult{} + + query := "SELECT COUNT(Id) AS Value FROM Channels WHERE Type = :ChannelType AND DeleteAt > 0" + + if len(teamId) > 0 { + query += " AND TeamId = :TeamId" + } + + v, err := s.GetReplica().SelectInt(query, map[string]interface{}{"TeamId": teamId, "ChannelType": channelType}) + if err != nil { + result.Err = model.NewLocAppError("SqlChannelStore.AnalyticsDeletedTypeCount", "store.sql_channel.analytics_deleted_type_count.app_error", nil, err.Error()) + } else { + result.Data = v + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} + func (s SqlChannelStore) ExtraUpdateByUser(userId string, time int64) StoreChannel { storeChannel := make(StoreChannel, 1) @@ -1546,6 +1572,7 @@ func (s SqlChannelStore) GetMembersByIds(channelId string, userIds []string) Sto result.Err = model.NewLocAppError("SqlChannelStore.GetMembersByIds", "store.sql_channel.get_members_by_ids.app_error", nil, "channelId="+channelId+" "+err.Error()) } else { result.Data = &members + } storeChannel <- result |