Skip to content

Instantly share code, notes, and snippets.



Last active Apr 3, 2019
What would you like to do?
interface NewPostDao {
@Query("SELECT * FROM `new_post`")
fun getAll(): Observable<List<NewPost>>
@Query("SELECT * FROM `new_post` WHERE `id` = :id")
fun getPostById(id: String): Observable<NewPost>
@Insert(onConflict = OnConflictStrategy.IGNORE)
fun insertNewPost(newPost: NewPost): Long
@Update(onConflict = OnConflictStrategy.REPLACE)
fun updateNewPost(newPost: NewPost)
fun deleteNewPost(newPost: NewPost)
fun upsert(newPost: NewPost) {
if (-1L == insertNewPost(newPost)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment