Skip to content

Instantly share code, notes, and snippets.

Created Oct 24, 2017
What would you like to do?
interface NoteDao {
@Insert(onConflict = OnConflictStrategy.ABORT)
fun insert(note: Note): Long
@Update(onConflict = OnConflictStrategy.ABORT)
fun update(note: Note): Int
@Query("SELECT * FROM notes")
fun observeAllNotes(): Flowable<Note>
@Query("SELECT * FROM notes WHERE id = :id")
fun findById(id: Long): Note
class NoteDaoHelper internal constructor(private val noteDao: NoteDao) : NoteDao by noteDao {
fun updateAndReturnNewValue(note: Note): Note {
return findById(
override fun observeAllNotes(): Flowable<Note> {
return noteDao.observeAllNotes().subscribeOn(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment