SELECT *
FROM accounts
WHERE (platform, innerID) NOT IN (
('platform_value1', 'innerID_value1'),
('platform_value2', 'innerID_value2'),
...
);
this is hard to use Swift Predicate:
func _fetchAccountNotIn(_ scope: [Account]) throws -> [Account] {
let scope = scope.map{ ($0.platform, $0.innerID) }
return try fetch(.init(predicate: #Predicate<Account> { !scope.contains(($0.platform, $0.innerID)) }))
}
shows compiler error: Cannot convert value of type '(String, String)' to expected argument type '((String, String)) throws -> Bool'
Account definition:
@Model
public final class Account {
#Unique<Account>([\.platform, \.innerID])
#Index<Account>([\.platform, \.innerID])
@Attribute(.preserveValueOnDeletion)
public private(set) var platform : String
@Attribute(.preserveValueOnDeletion)
public private(set) var innerID : String
}