Open neallester opened 6 years ago
Add to class Entity:
public func asyncIfUpdated (batch: Batch, closure: @escaping (inout T) -> Void) {} public func syncIfUpdated (batch: Batch, closure: @escaping (inout T) -> Void) {}
which adds self to the batch (and updates persistentState) only if a persistent attribute in the item was actually changed. One implementation: serialize item before and after executing closure and doing the update only if they differ.
Add to class Entity:
which adds self to the batch (and updates persistentState) only if a persistent attribute in the item was actually changed. One implementation: serialize item before and after executing closure and doing the update only if they differ.