Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created March 16, 2018 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skydoves/ed8aba6a97d291bf4fee47e29a1a5059 to your computer and use it in GitHub Desktop.
Save skydoves/ed8aba6a97d291bf4fee47e29a1a5059 to your computer and use it in GitHub Desktop.
HistoryDao
@Dao
interface HistoryDao {
@Query("SELECT* FROM SearchHistory ORDER BY history DESC LIMIT 20")
fun selectRecentHistoryList(): LiveData<List<History>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertHistory(history: History)
@Query("DELETE FROM SearchHistory WHERE search = :search")
fun deleteHistory(search: String)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment