mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-02-21 15:17:45 +01:00
WIP: Unit tests
This commit is contained in:
@@ -96,31 +96,25 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
|
||||
Immediately flushes all pending changes to the transaction's observers. This is useful in conjunction with `ListMonitor`s and `ObjectMonitor`s created from `UnsafeDataTransaction`s used to manage temporary "scratch" data.
|
||||
|
||||
- Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`)
|
||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||
*/
|
||||
@objc
|
||||
public func flush(error error: NSErrorPointer) {
|
||||
public func flush() {
|
||||
|
||||
bridge(error) {
|
||||
|
||||
try self.bridgeToSwift.flush()
|
||||
}
|
||||
self.bridgeToSwift.flush()
|
||||
}
|
||||
|
||||
/**
|
||||
Flushes all pending changes to the transaction's observers at the end of the `closure`'s execution. This is useful in conjunction with `ListMonitor`s and `ObjectMonitor`s created from `UnsafeDataTransaction`s used to manage temporary "scratch" data.
|
||||
|
||||
- Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`)
|
||||
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
|
||||
- parameter closure: the closure where changes can be made prior to the flush
|
||||
*/
|
||||
@objc
|
||||
public func flush(error error: NSErrorPointer, block: () -> Void) throws {
|
||||
public func flush(block: () -> Void) {
|
||||
|
||||
bridge(error) {
|
||||
self.bridgeToSwift.flush {
|
||||
|
||||
block()
|
||||
try self.bridgeToSwift.context.save()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user