summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
Diffstat (limited to 'store')
-rw-r--r--store/sql_emoji_store.go7
-rw-r--r--store/sql_emoji_store_test.go4
-rw-r--r--store/store.go2
3 files changed, 7 insertions, 6 deletions
diff --git a/store/sql_emoji_store.go b/store/sql_emoji_store.go
index 2a8ea080e..6e50248a9 100644
--- a/store/sql_emoji_store.go
+++ b/store/sql_emoji_store.go
@@ -150,7 +150,7 @@ func (es SqlEmojiStore) GetByName(name string) StoreChannel {
return storeChannel
}
-func (es SqlEmojiStore) GetAll() StoreChannel {
+func (es SqlEmojiStore) GetList(offset, limit int) StoreChannel {
storeChannel := make(StoreChannel, 1)
go func() {
@@ -164,8 +164,9 @@ func (es SqlEmojiStore) GetAll() StoreChannel {
FROM
Emoji
WHERE
- DeleteAt = 0`); err != nil {
- result.Err = model.NewLocAppError("SqlEmojiStore.Get", "store.sql_emoji.get_all.app_error", nil, err.Error())
+ DeleteAt = 0
+ LIMIT :Limit OFFSET :Offset`, map[string]interface{}{"Offset": offset, "Limit": limit}); err != nil {
+ result.Err = model.NewAppError("SqlEmojiStore.GetList", "store.sql_emoji.get_all.app_error", nil, err.Error(), http.StatusInternalServerError)
} else {
result.Data = emoji
}
diff --git a/store/sql_emoji_store_test.go b/store/sql_emoji_store_test.go
index 09cdbeead..25e0f7916 100644
--- a/store/sql_emoji_store_test.go
+++ b/store/sql_emoji_store_test.go
@@ -126,7 +126,7 @@ func TestEmojiGetByName(t *testing.T) {
}
}
-func TestEmojiGetAll(t *testing.T) {
+func TestEmojiGetList(t *testing.T) {
Setup()
emojis := []model.Emoji{
@@ -153,7 +153,7 @@ func TestEmojiGetAll(t *testing.T) {
}
}()
- if result := <-store.Emoji().GetAll(); result.Err != nil {
+ if result := <-store.Emoji().GetList(0, 100); result.Err != nil {
t.Fatal(result.Err)
} else {
for _, emoji := range emojis {
diff --git a/store/store.go b/store/store.go
index 9ae5f4b81..0007f495e 100644
--- a/store/store.go
+++ b/store/store.go
@@ -349,7 +349,7 @@ type EmojiStore interface {
Save(emoji *model.Emoji) StoreChannel
Get(id string, allowFromCache bool) StoreChannel
GetByName(name string) StoreChannel
- GetAll() StoreChannel
+ GetList(offset, limit int) StoreChannel
Delete(id string, time int64) StoreChannel
}