Skip to content

Instantly share code, notes, and snippets.

@YoloSwagBot
Created September 6, 2019 20:32
Show Gist options
  • Save YoloSwagBot/0cecf25a4e16ec0ea1e202756832294e to your computer and use it in GitHub Desktop.
Save YoloSwagBot/0cecf25a4e16ec0ea1e202756832294e to your computer and use it in GitHub Desktop.
Room DataBase object
package com.appstr.bruhusrs.data
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.appstr.bruhusrs.singleton.SingletonHolder
import com.appstr.bruhusrs.util.DATABASE_NAME
@Database(entities = [OurData::class], version = 1, exportSchema = false)
abstract class OurDB : RoomDatabase() {
abstract fun ourDataDao(): OurDataDao
companion object : SingletonHolder<OurDB, Context>({
Room.databaseBuilder(
it.applicationContext,
OurDB::class.java,
DATABASE_NAME
).build()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment