From 3c6b7388e27129abf893128d22fa809764745f29 Mon Sep 17 00:00:00 2001 From: ashiagr Date: Mon, 6 Feb 2023 17:54:02 +0530 Subject: [PATCH] Add limit --- .../shiftyjelly/pocketcasts/models/db/dao/SearchHistoryDao.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/SearchHistoryDao.kt b/modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/SearchHistoryDao.kt index 86150d4172f..5fae7aac59a 100644 --- a/modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/SearchHistoryDao.kt +++ b/modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/SearchHistoryDao.kt @@ -11,8 +11,8 @@ import au.com.shiftyjelly.pocketcasts.models.entity.SearchHistoryItem @Dao abstract class SearchHistoryDao { @Transaction - @Query("SELECT * FROM search_history ORDER BY modified DESC") - abstract fun findAll(): List + @Query("SELECT * FROM search_history ORDER BY modified DESC LIMIT :limit") + abstract fun findAll(limit: Int = 10): List @Insert(onConflict = OnConflictStrategy.REPLACE) abstract suspend fun insert(searchHistoryItem: SearchHistoryItem)