mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-24 17:48:32 +02:00
allow preprocessing dictionary mapping before importing objects
This commit is contained in:
@@ -174,7 +174,7 @@ public extension BaseDataTransaction {
|
|||||||
func importUniqueObjects<T where T: NSManagedObject, T: ImportableUniqueObject>(
|
func importUniqueObjects<T where T: NSManagedObject, T: ImportableUniqueObject>(
|
||||||
into: Into<T>,
|
into: Into<T>,
|
||||||
sourceArray: [T.ImportSource],
|
sourceArray: [T.ImportSource],
|
||||||
preProcess: ((mapping: [T.UniqueIDType: T.ImportSource]) throws -> Void)? = nil) throws {
|
preProcess: ((inout mapping: [T.UniqueIDType: T.ImportSource]) throws -> Void)? = nil) throws {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(),
|
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(),
|
||||||
@@ -202,7 +202,7 @@ public extension BaseDataTransaction {
|
|||||||
|
|
||||||
try autoreleasepool {
|
try autoreleasepool {
|
||||||
|
|
||||||
try preProcess(mapping: mapping)
|
try preProcess(mapping: &mapping)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ public extension BaseDataTransaction {
|
|||||||
func importUniqueObjects<T where T: NSManagedObject, T: ImportableUniqueObject>(
|
func importUniqueObjects<T where T: NSManagedObject, T: ImportableUniqueObject>(
|
||||||
into: Into<T>,
|
into: Into<T>,
|
||||||
sourceArray: [T.ImportSource],
|
sourceArray: [T.ImportSource],
|
||||||
preProcess: ((mapping: [T.UniqueIDType: T.ImportSource]) throws -> Void)? = nil,
|
preProcess: ((inout mapping: [T.UniqueIDType: T.ImportSource]) throws -> Void)? = nil,
|
||||||
postProcess: (sorted: [T]) -> Void) throws {
|
postProcess: (sorted: [T]) -> Void) throws {
|
||||||
|
|
||||||
CoreStore.assert(
|
CoreStore.assert(
|
||||||
@@ -261,7 +261,7 @@ public extension BaseDataTransaction {
|
|||||||
|
|
||||||
try autoreleasepool {
|
try autoreleasepool {
|
||||||
|
|
||||||
try preProcess(mapping: mapping)
|
try preProcess(mapping: &mapping)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user