diff options
Diffstat (limited to 'store/sql_preference_store.go')
-rw-r--r-- | store/sql_preference_store.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/store/sql_preference_store.go b/store/sql_preference_store.go index e20226ce6..5c46d1328 100644 --- a/store/sql_preference_store.go +++ b/store/sql_preference_store.go @@ -326,3 +326,25 @@ func (s SqlPreferenceStore) Delete(userId, category, name string) StoreChannel { return storeChannel } + +func (s SqlPreferenceStore) DeleteCategory(userId string, category string) StoreChannel { + storeChannel := make(StoreChannel, 1) + + go func() { + result := StoreResult{} + + if _, err := s.GetMaster().Exec( + `DELETE FROM + Preferences + WHERE + UserId = :UserId + AND Category = :Category`, map[string]interface{}{"UserId": userId, "Category": category}); err != nil { + result.Err = model.NewLocAppError("SqlPreferenceStore.DeleteCategory", "store.sql_preference.delete.app_error", nil, err.Error()) + } + + storeChannel <- result + close(storeChannel) + }() + + return storeChannel +} |