magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.8k forks source link

Request: Support batch request #1246

Closed EddieLukeAtmey closed 5 months ago

EddieLukeAtmey commented 8 years ago

Hi, I've just used MagicalRecord for my new project, and I found it quite interesting, efficiently. But I'd like to request a new feature for magical record (I suggest that it should work on iOS 8.0 and above), it is:

  1. Batch update entity of a class:
    • Use a predicate to filter which entity should perform batch update.
    • Use a dictionary (key = propertyName, value = batchUpdatedValue) to perform update values. Note: In iOS 8.4 and above, we can use NSBatchUpdateRequest.
  2. Batch Delete entity of a class:
    • Use predicate to filter which entity should perform batch delete. Note: in iOS 9.0 and above (this I'm not sure myself), we can use NSBatchDeleteRequest.
  3. Batch Insert
    • Currently, I'm not using this, and I read that you already have import features, so I suppose I don't need to write anything here.

What do you think about this request?

EddieLukeAtmey commented 8 years ago

I see in issue #1104 and #1106, the batch update request support has been added. But, I haven't found any document about this, so I supposed it's not working yet, right?

Also, in my request, there's a batch delete request, so.... I supposed you got it :/

pronebird commented 7 years ago

@EddieLukeAtmey I've added those but then I closed my PR since I encountered some problems with stale managed objects after running batch requests. Not sure what was the deal, but I haven't used them since then, therefore couldn't even properly test it.

mihaipuscasimprezzio commented 7 years ago

Hi, any news about supporting batch update?

hotngui commented 7 years ago

Batch requests do not update the context as per Apple's 2015 WWDC presentation. They work directly on the persistent store.

EddieLukeAtmey commented 7 years ago

@hotngui so what? We can always and we always, as recommended, refresh the context after batch requests.