Created
April 14, 2019 15:04
-
-
Save amit-bhandari/b84837b44fade5424df0772555a00e7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Dao | |
public interface QuoteDAO { | |
@Insert(onConflict = REPLACE) | |
void cacheOnDB(List<Quote> quote); | |
@Query("SELECT * FROM quote") | |
LiveData<List<Quote>>getCachedQuotes(); | |
//for saved quotes (starred quotes) | |
@Insert(onConflict = REPLACE) | |
void saveOnDevice(SavedQuote quote); | |
//no need of live data, we won’t be making any changes to it | |
@Query("SELECT * FROM savedquote") | |
List<SavedQuote> getSavedQuotes(); | |
@Delete | |
void deleteQuote(SavedQuote quote); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment