Created
June 16, 2020 07:27
-
-
Save zijianjoy/3dad3f83936274d04dca7d86e91bdf3b 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
import androidx.lifecycle.LiveData; | |
import androidx.room.Dao; | |
import androidx.room.Insert; | |
import androidx.room.OnConflictStrategy; | |
import androidx.room.Query; | |
import java.util.List; | |
@Dao | |
interface ArticleDao { | |
@Insert(onConflict = OnConflictStrategy.IGNORE) | |
void addArticle(Article article); | |
@Query("DELETE FROM articles") | |
void deleteAll(); | |
@Query("SELECT * FROM articles") | |
LiveData<List<Article>> getArticleList(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment