Originally created by @JohnEstropia on GitHub (Aug 26, 2016).
Objective: allow a way to fetch objects in a way that can wait for completion of
Store migrations (need to explicitly provide configuration in Into<Entity>("...") clause)
Heavy queries
Originally created by @JohnEstropia on GitHub (Aug 26, 2016).
Objective: allow a way to fetch objects in a way that can wait for completion of
1. Store migrations (need to explicitly provide configuration in `Into<Entity>("...")` clause)
2. Heavy queries
@JohnEstropia Hi JohnEstropia, it's a great open source for core data. Does CoreStore only support fetch records on the main thread? If a large number of records, does it block the main thread?
@flyingcane commented on GitHub (Dec 27, 2017):
@JohnEstropia Hi JohnEstropia, it's a great open source for core data. Does CoreStore only support fetch records on the main thread? If a large number of records, does it block the main thread?
@evanxie-cn If you have very large fetches (e.g. image binary data, few thousand objects) you can always fetch from a background transaction and pass the info you need to the main thread. Here's an example:
dataStack.perform(asynchronous:{(transaction)->[UIImage]inletpeople=transaction.fetchAll(From<Person>().where(/* ... */))returnpeople.map{UIImage(data:$0.imageData)!}},completion:{(photos)in/* ... */// use photos})
Depending on your confidence on your app architecture, you can also use unsafe transactions (dataStack.beginUnsafe()) in conjunction with your own DispatchQueues.
@JohnEstropia commented on GitHub (Dec 27, 2017):
@evanxie-cn If you have very large fetches (e.g. image binary data, few thousand objects) you can always fetch from a background transaction and pass the info you need to the main thread. Here's an example:
```swift
dataStack.perform(
asynchronous: { (transaction) -> [UIImage] in
let people = transaction.fetchAll(From<Person>().where(/* ... */))
return people.map { UIImage(data: $0.imageData)! }
},
completion: { (photos) in /* ... */
// use photos
}
)
```
Depending on your confidence on your app architecture, you can also use unsafe transactions (`dataStack.beginUnsafe()`) in conjunction with your own `DispatchQueue`s.
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 @JohnEstropia on GitHub (Aug 26, 2016).
Objective: allow a way to fetch objects in a way that can wait for completion of
Into<Entity>("...")clause)@flyingcane commented on GitHub (Dec 27, 2017):
@JohnEstropia Hi JohnEstropia, it's a great open source for core data. Does CoreStore only support fetch records on the main thread? If a large number of records, does it block the main thread?
@JohnEstropia commented on GitHub (Dec 27, 2017):
@evanxie-cn If you have very large fetches (e.g. image binary data, few thousand objects) you can always fetch from a background transaction and pass the info you need to the main thread. Here's an example:
Depending on your confidence on your app architecture, you can also use unsafe transactions (
dataStack.beginUnsafe()) in conjunction with your ownDispatchQueues.@flyingcane commented on GitHub (Dec 28, 2017):
@JohnEstropia Thank you very much. I got it.