mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-14 07:33:28 +01:00
Can CoreStore fetch all unique entity atributes? #274
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @OlionCompany on GitHub (May 23, 2019).
How can I get all the unique attributes from an Entity?
E.g.:
EntityA = "a: String?, b: Int?, entityB: EntityB?"
EntityB = "a: String?, b: Int?"
My code:
fetchAll waits for [EntityA] and crash to return
@JohnEstropia commented on GitHub (May 24, 2019):
You can use
queryAttributes(...)for this. See https://github.com/JohnEstropia/CoreStore#querying (Specifically the entries onqueryAttributes(...))@OlionCompany commented on GitHub (May 24, 2019):
I tried and it doesn't work
СoreStore can't do requests of the attributes with a check for uniqueness.
@JohnEstropia commented on GitHub (May 24, 2019):
Sorry, I'm not sure I understood your question then. Your example says
so I assumed you were querying properties. Can you give a concrete example of data and what results you are after?
@OlionCompany commented on GitHub (May 29, 2019):
This question can be closed, I think I figured it out.
If you're trying to extract query attribute from EntityA as other CoreData Entity -> result: Array of [String : NSManagedObjectID].
After conversion we need to fetch entities for this ids. Example:
In Tweak we can add { $0.resultType = .managedObjectResultType }) for fetch Entities instead Ids, but, app crashes.