Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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(): DataSource.Factory<Int, 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.