mirror of
https://github.com/modo-studio/SugarRecord.git
synced 2024-08-16 18:00:26 +03:00
Add filteredWith IN and NOT IN (#305)
* fiteredWith IN and NOT IN added * Update Request.swift
This commit is contained in:
parent
b57b57be29
commit
037260e81f
@ -45,6 +45,17 @@ public struct FetchRequest<T: Entity>: Equatable {
|
||||
.request(withPredicate: NSPredicate(format: "\(key) == %@", value))
|
||||
}
|
||||
|
||||
public func filtered(with key: String, in value: [String]) -> FetchRequest<T> {
|
||||
return self
|
||||
.request(withPredicate: NSPredicate(format: "\(key) IN %@", value))
|
||||
}
|
||||
|
||||
public func filtered(with key: String, notIn value: [String]) -> FetchRequest<T> {
|
||||
return self
|
||||
.request(withPredicate: NSPredicate(format: "NOT (\(key) IN %@)", value))
|
||||
}
|
||||
|
||||
|
||||
public func sorted(with sortDescriptor: NSSortDescriptor) -> FetchRequest<T> {
|
||||
return self
|
||||
.request(withSortDescriptor: sortDescriptor)
|
||||
|
Loading…
Reference in New Issue
Block a user