fetches, queries, and deletes are now throwable methods

This commit is contained in:
John Estropia
2019-01-15 20:40:15 +09:00
parent 5777831565
commit 682472c1bd
30 changed files with 1239 additions and 1352 deletions

View File

@@ -151,7 +151,7 @@ public extension BaseDataTransaction {
return nil
}
if let object = self.fetchOne(From(entityType), Where<D>(uniqueIDKeyPath, isEqualTo: uniqueIDValue)) {
if let object = try self.fetchOne(From(entityType), Where<D>(uniqueIDKeyPath, isEqualTo: uniqueIDValue)) {
guard entityType.shouldUpdate(from: source, in: self) else {
@@ -215,7 +215,8 @@ public extension BaseDataTransaction {
importSourceByID = try autoreleasepool { try preProcess(importSourceByID) }
var existingObjectsByID = Dictionary<D.UniqueIDType, D>()
self.fetchAll(From(entityType), Where<D>(entityType.uniqueIDKeyPath, isMemberOf: sortedIDs))?
try self
.fetchAll(From(entityType), Where<D>(entityType.uniqueIDKeyPath, isMemberOf: sortedIDs))
.forEach { existingObjectsByID[$0.uniqueIDValue] = $0 }
var processedObjectIDs = Set<D.UniqueIDType>()