Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
interface PostApiService {
@GET("/feed")
fun getFeed(): Single<Response<List<Post>>>
}
@Dao
interface PostDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
fun insert(post: Post): Long
@Update(onConflict = OnConflictStrategy.REPLACE)
fun update(post: Post)
@Transaction
fun upsert(post: Post) {
if (-1L == insert(post))
update(post)
}
@Query("SELECT * FROM `post`")
fun getPostList(): Observable<List<Post>>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.