Skip to content

Instantly share code, notes, and snippets.

@mcmatan
Created August 17, 2018 05:11
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 mcmatan/077489a342aead1a306bb1b2d7dc48f4 to your computer and use it in GitHub Desktop.
Save mcmatan/077489a342aead1a306bb1b2d7dc48f4 to your computer and use it in GitHub Desktop.
class DataBase @Inject constructor() {
private val realmLock = RealmLock()
//Home feed items
private fun getFeedItem(id: String): HomeFeedItem? {
return realmActions.getRealm()
.where<HomeFeedItem>().equalTo("_id", id).findFirst()
}
override fun deleteHomeFeedItem(id: String) {
realmActions.transaction {
val homeFeedItem = getFeedItem(id)
homeFeedItem?.deleteFromRealm()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment