|
|
|
|
@ -178,7 +178,22 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Inserts the whole sequence into the items array, no updates |
|
|
|
|
/// Deletes all items of the sequence by id |
|
|
|
|
public func delete(contentOfs sequence: any Sequence<T>) throws { |
|
|
|
|
|
|
|
|
|
defer { |
|
|
|
|
self._hasChanged = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for instance in sequence { |
|
|
|
|
try instance.deleteDependencies() |
|
|
|
|
self.items.removeAll { $0.id == instance.id } |
|
|
|
|
self._index?.removeValue(forKey: instance.stringId) |
|
|
|
|
try self._sendDeletionIfNecessary(instance) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Inserts or updates all items in the sequence |
|
|
|
|
public func addOrUpdate(contentOfs sequence: any Sequence<T>) throws { |
|
|
|
|
defer { |
|
|
|
|
self._hasChanged = true |
|
|
|
|
|