mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Where clause missing CONTAINS comparison option
#435
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 @vovsyannikov on GitHub (Jun 20, 2024).
In my project there's a stored property with search info. What I would like to do is fetch all the objects that contains some searchable string. Right now the only way I see doing it is through unsafe
NSPredicatewhere I can't even user#keyPath(Document.searchInfo)to alleviate some of the risksAm I missing something or is it the only way of handling
CONTAINSin CoreStore?@JohnEstropia commented on GitHub (Jun 21, 2024):
Yes, the type-syntax utilities are currently missing several predicate features. You can always write the raw String format for now, but as it is I'm still observing how the SwiftData utilities are evolving to see which ones we can hook up with CoreStore.
As always, if you have proposed implementations feel free to submit a PR.
@JohnEstropia commented on GitHub (Jun 21, 2024):
Just a tip though, you can use
%Kso that you can still take advantage of#keyPath:@vovsyannikov commented on GitHub (Jun 21, 2024):
Yes I am aware of such method. However that's the problem: I get en error that
searchInfois not@objcmarked. It's a@Field.Storedproperty so it seems that stringly typedNSPredicateis the only way out@JohnEstropia commented on GitHub (Jun 21, 2024):
Ah, I see. Sorry, I thought your model was using the
NSManagedObjectmode. For theCoreStoreObjectsubclasses, you can do this instead:@vovsyannikov commented on GitHub (Jun 21, 2024):
Oooh. That's neat. Thanks!