Yokan / rebuild
Course 1 8624561

PersistentDatabase.nonWeb.kt

composeApp/src/nonWebMain/kotlin/eu/friedcutlet/yokan/database/PersistentDatabase.nonWeb.kt

implementation15 lines
1package eu.friedcutlet.yokan.database23/**4 * Room-backed persistence. A pre-existing JSON snapshot is only consulted on5 * the cold path where Room is empty — passing a `() -> YokanDatabaseSnapshot?`6 * instead of a fully loaded one avoids paying the JSON read on every7 * subsequent boot.8 */9actual fun createDefaultDatabase(): YokanDatabase = createProfileDatabase(eu.friedcutlet.yokan.domain.ProfileId.Default)1011actual fun createProfileDatabase(profileId: eu.friedcutlet.yokan.domain.ProfileId): YokanDatabase =12    eu.friedcutlet.yokan.database.room.RoomYokanDatabase(13        room = eu.friedcutlet.yokan.database.room.createYokanRoomDatabase(profileId),14        legacySnapshotProvider = { if (profileId == eu.friedcutlet.yokan.domain.ProfileId.Default) createDefaultDatabaseSnapshotStore().load() else null },15    )16

Search chapters, reference and source filenames.