Skip to content

Instantly share code, notes, and snippets.

@TKolbusz
Last active June 15, 2017 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TKolbusz/5e1f0da09917c61bfc47ee478fa90d52 to your computer and use it in GitHub Desktop.
Save TKolbusz/5e1f0da09917c61bfc47ee478fa90d52 to your computer and use it in GitHub Desktop.
Controlling database flow using Room and RxJava2
@Dao
interface ItemDao {
@Query("SELECT name, place, description, date_added_ms FROM items")
fun getAllItems(): Flowable<List<Item>>
@Query("SELECT name FROM items WHERE place = :arg0")
fun getItemsAt(place: String): Flowable<List<Item>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertItem(item: Item)
@Delete
fun deleteItem(item: Item)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment