Last active
June 21, 2024 15:23
-
-
Save binayshaw7777/af86d565d710c89f869a6335045ea918 to your computer and use it in GitHub Desktop.
Desktop Database builder for Room KMP/CMP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // composeApp/src/desktopMain/kotlin/database/Database.kt | |
| import androidx.room.Room | |
| import androidx.room.RoomDatabase | |
| import data.database.DictionaryDatabase | |
| import java.io.File | |
| fun getDatabaseBuilder(): RoomDatabase.Builder<DictionaryDatabase> { | |
| val dbFile = File(System.getProperty("java.io.tmpdir"), "user.db") | |
| return Room.databaseBuilder<DictionaryDatabase>( | |
| name = dbFile.absolutePath, | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment