Permalink
Browse files

Update to Room 2.1.0-alpha04

Use suspending delete queries where possible.
  • Loading branch information...
ianhanniballake committed Jan 28, 2019
1 parent d412b46 commit e0654201230e1cf521bc190014aa8526800974b0
@@ -32,7 +32,7 @@ buildscript {
materialVersion = "1.0.0"
constraintLayoutVersion = "2.0.0-alpha3"
lifecycleVersion = "2.1.0-alpha01"
roomVersion = "2.1.0-alpha03"
roomVersion = "2.1.0-alpha04"
pagingVersion = "2.1.0"
navigationVersion = "1.0.0-alpha11"
workManagerVersion = "1.0.0-beta03"
@@ -200,13 +200,14 @@ internal abstract class ChosenPhotoDao {
abstract suspend fun getChosenPhotos(ids: List<Long>): List<ChosenPhoto>

@Query("DELETE FROM chosen_photos WHERE _id IN (:ids)")
internal abstract fun deleteInternal(ids: List<Long>)
internal abstract suspend fun deleteInternal(ids: List<Long>)

suspend fun delete(context: Context, ids: List<Long>) = withContext(Dispatchers.Default) {
deleteBackingPhotos(context, getChosenPhotos(ids))
deleteInternal(ids)
}

// Can't be suspend due to https://issuetracker.google.com/issues/123466702
@Query("DELETE FROM chosen_photos")
internal abstract fun deleteAllInternal()

0 comments on commit e065420

Please sign in to comment.