Tankōbon / main/db/import-service / applyImport
Function: applyImport()
applyImport(
db,libraryRepo,settingsRepo,readingListRepo,data):object
Defined in: main/db/import-service.ts:175
Merges a parsed snapshot into the local database: library entries are matched by file path (the snapshot wins for the ones it contains, so restoring a backup restores its progress, ratings and tags), entries only present locally are left alone, and settings are replaced. Reading lists are matched by id, the snapshot winning too (their order included: the snapshot's lists come first, in its order); their books are found by path, and a path that matches no library entry is dropped.
All or nothing: the whole merge runs in one transaction, so an error midway leaves the database as it was, and 2 000 books take a fraction of the time of one commit per statement. db must be the database the three repositories were built on.
Parameters
db
DatabaseSync
libraryRepo
settingsRepo
readingListRepo
data
Returns
object
added
added:
number
updated
updated:
number