Originally created by @shift00 on GitHub (Nov 29, 2017).
Hi,
can anyone tell me, does CoreStore supports batch requests? I need write multiple changes into database on existing data, but I can't find good solution for this problem.
For example NSBatchUpdateRequest seems like this: let batchRequest = NSBatchUpdateRequest(entityName: "SomeEntity") batchRequest.propertiesToUpdate = ["status": PointType.new.rawValue] batchRequest.resultType = .updatedObjectIDsResultType
Originally created by @shift00 on GitHub (Nov 29, 2017).
Hi,
can anyone tell me, does CoreStore supports batch requests? I need write multiple changes into database on existing data, but I can't find good solution for this problem.
For example NSBatchUpdateRequest seems like this:
`let batchRequest = NSBatchUpdateRequest(entityName: "SomeEntity")
batchRequest.propertiesToUpdate = ["status": PointType.new.rawValue]
batchRequest.resultType = .updatedObjectIDsResultType`
@JohnEstropia commented on GitHub (Nov 29, 2017):
Hi, batch requests are currently not yet implemented, sorry.
You should still be able to do this manually within transactions:
```swift
CoreStore.perform(
asynchronous: { (transaction) in
let batchRequest = NSBatchUpdateRequest(
entity: CoreStore.defaultStack.entityDescription(for: YourEntity.self)!
)
batchRequest.propertiesToUpdate = ["status": PointType.new.rawValue]
batchRequest.resultType = .updatedObjectIDsResultType
try transaction.unsafeContext().execute(batchRequest)
},
completion: { _ in /* ... */ }
)
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @shift00 on GitHub (Nov 29, 2017).
Hi,
can anyone tell me, does CoreStore supports batch requests? I need write multiple changes into database on existing data, but I can't find good solution for this problem.
For example NSBatchUpdateRequest seems like this:
let batchRequest = NSBatchUpdateRequest(entityName: "SomeEntity") batchRequest.propertiesToUpdate = ["status": PointType.new.rawValue] batchRequest.resultType = .updatedObjectIDsResultType@JohnEstropia commented on GitHub (Nov 29, 2017):
Hi, batch requests are currently not yet implemented, sorry.
You should still be able to do this manually within transactions:
@shift00 commented on GitHub (Nov 30, 2017):
It's working! Thanks.