revert null overloads, remove optional objectIDs as condition

This commit is contained in:
John Rommel Estropia
2017-11-09 23:26:53 +09:00
parent 9ea5073bc8
commit dd4e47d7f9

View File

@@ -76,17 +76,6 @@ public func == <O: NSManagedObject, V: QueryableAttributeType & Equatable>(_ key
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: value)
}
/**
Creates a `Where` clause by comparing if a property is equal to a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.nickname == nil))
```
*/
public func == <O: NSManagedObject, V: QueryableAttributeType & Equatable>(_ keyPath: KeyPath<O, Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K == nil", keyPath._kvcKeyPathString!)
}
/**
Creates a `Where` clause by comparing if a property is not equal to a value
```
@@ -98,17 +87,6 @@ public func != <O: NSManagedObject, V: QueryableAttributeType & Equatable>(_ key
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: value)
}
/**
Creates a `Where` clause by comparing if a property is not equal to a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.nickname != nil))
```
*/
public func != <O: NSManagedObject, V: QueryableAttributeType & Equatable>(_ keyPath: KeyPath<O, Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K != nil", keyPath._kvcKeyPathString!)
}
/**
Creates a `Where` clause by checking if a sequence contains the value of a property
```
@@ -188,17 +166,6 @@ public func < <O: NSManagedObject, V: QueryableAttributeType & Comparable>(_ key
}
}
/**
Creates a `Where` clause by comparing if a property is less than a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.age < 20))
```
*/
public func < <O: NSManagedObject, V: QueryableAttributeType & Comparable>(_ keyPath: KeyPath<O, Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K < nil", keyPath._kvcKeyPathString!)
}
/**
Creates a `Where` clause by comparing if a property is greater than a value
```
@@ -217,17 +184,6 @@ public func > <O: NSManagedObject, V: QueryableAttributeType & Comparable>(_ key
}
}
/**
Creates a `Where` clause by comparing if a property is greater than a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.age > nil))
```
*/
public func > <O: NSManagedObject, V: QueryableAttributeType & Comparable>(_ keyPath: KeyPath<O, Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K > nil", keyPath._kvcKeyPathString!)
}
/**
Creates a `Where` clause by comparing if a property is less than or equal to a value
```
@@ -246,17 +202,6 @@ public func <= <O: NSManagedObject, V: QueryableAttributeType & Comparable>(_ ke
}
}
/**
Creates a `Where` clause by comparing if a property is less than or equal to a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.age <= nil))
```
*/
public func <= <O: NSManagedObject, V: QueryableAttributeType & Comparable>(_ keyPath: KeyPath<O, Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K <= nil", keyPath._kvcKeyPathString!)
}
/**
Creates a `Where` clause by comparing if a property is greater than or equal to a value
```
@@ -275,17 +220,6 @@ public func >= <O: NSManagedObject, V: QueryableAttributeType & Comparable>(_ ke
}
}
/**
Creates a `Where` clause by comparing if a property is greater than or equal to a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.age >= nil))
```
*/
public func >= <O: NSManagedObject, V: QueryableAttributeType & Comparable>(_ keyPath: KeyPath<O, Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K >= nil", keyPath._kvcKeyPathString!)
}
// MARK: - KeyPath where Root: NSManagedObject, Value: NSManagedObject
@@ -328,7 +262,7 @@ public func ~= <O: NSManagedObject, D: NSManagedObject, S: Sequence>(_ sequence:
let dog = CoreStore.fetchOne(From<Dog>().where(\.master == john))
```
*/
public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, D>, _ objectID: NSManagedObjectID?) -> Where<O> {
public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, D>, _ objectID: NSManagedObjectID) -> Where<O> {
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: objectID)
}
@@ -339,7 +273,7 @@ public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, D>
let dog = CoreStore.fetchOne(From<Dog>().where(\.master != john))
```
*/
public func != <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, D>, _ objectID: NSManagedObjectID?) -> Where<O> {
public func != <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, D>, _ objectID: NSManagedObjectID) -> Where<O> {
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: objectID)
}
@@ -369,17 +303,6 @@ public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Op
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object)
}
/**
Creates a `Where` clause by comparing if a property is equal to a value
```
let dog = CoreStore.fetchOne(From<Dog>().where(\.master == nil))
```
*/
public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Optional<D>>, _ null: Void?) -> Where<O> {
return Where<O>("%K == nil", keyPath._kvcKeyPathString!)
}
/**
Creates a `Where` clause by comparing if a property is not equal to a value
```
@@ -391,17 +314,6 @@ public func != <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Op
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object)
}
/**
Creates a `Where` clause by comparing if a property is not equal to a value
```
let dog = CoreStore.fetchOne(From<Dog>().where(\.master != nil))
```
*/
public func != <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Optional<D>>, _ null: Void?) -> Where<O> {
return Where<O>("%K != nil", keyPath._kvcKeyPathString!)
}
/**
Creates a `Where` clause by checking if a sequence contains a value of a property
```
@@ -419,7 +331,7 @@ public func ~= <O: NSManagedObject, D: NSManagedObject, S: Sequence>(_ sequence:
let dog = CoreStore.fetchOne(From<Dog>().where(\.master == john))
```
*/
public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Optional<D>>, _ objectID: NSManagedObjectID?) -> Where<O> {
public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Optional<D>>, _ objectID: NSManagedObjectID) -> Where<O> {
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: objectID)
}
@@ -430,7 +342,7 @@ public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Op
let dog = CoreStore.fetchOne(From<Dog>().where(\.master != john))
```
*/
public func != <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Optional<D>>, _ objectID: NSManagedObjectID?) -> Where<O> {
public func != <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Optional<D>>, _ objectID: NSManagedObjectID) -> Where<O> {
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: objectID)
}
@@ -496,17 +408,6 @@ public func == <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ va
return Where<O>(O.meta[keyPath: keyPath].keyPath, isEqualTo: value)
}
/**
Creates a `Where` clause by comparing if a property is equal to a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.nickname == nil))
```
*/
public func == <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K == nil", O.meta[keyPath: keyPath].keyPath)
}
/**
Creates a `Where` clause by comparing if a property is not equal to a value
```
@@ -518,17 +419,6 @@ public func != <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ va
return !Where<O>(O.meta[keyPath: keyPath].keyPath, isEqualTo: value)
}
/**
Creates a `Where` clause by comparing if a property is not equal to a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.nickname != nil))
```
*/
public func != <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K != nil", O.meta[keyPath: keyPath].keyPath)
}
/**
Creates a `Where` clause by checking if a sequence contains the value of a property
```
@@ -608,17 +498,6 @@ public func < <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ val
}
}
/**
Creates a `Where` clause by comparing if a property is less than a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.age < nil))
```
*/
public func < <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K < nil", O.meta[keyPath: keyPath].keyPath)
}
/**
Creates a `Where` clause by comparing if a property is greater than a value
```
@@ -637,17 +516,6 @@ public func > <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ val
}
}
/**
Creates a `Where` clause by comparing if a property is greater than a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.age > nil))
```
*/
public func > <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K > nil", O.meta[keyPath: keyPath].keyPath)
}
/**
Creates a `Where` clause by comparing if a property is less than or equal to a value
```
@@ -666,17 +534,6 @@ public func <= <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ va
}
}
/**
Creates a `Where` clause by comparing if a property is less than or equal to a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.age <= nil))
```
*/
public func <= <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K <= nil", O.meta[keyPath: keyPath].keyPath)
}
/**
Creates a `Where` clause by comparing if a property is greater than or equal to a value
```
@@ -695,17 +552,6 @@ public func >= <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ va
}
}
/**
Creates a `Where` clause by comparing if a property is greater than or equal to a value
```
let person = CoreStore.fetchOne(From<Person>().where(\.age >= nil))
```
*/
public func >= <O, V>(_ keyPath: KeyPath<O, ValueContainer<O>.Optional<V>>, _ null: Void?) -> Where<O> {
return Where<O>("%K >= nil", O.meta[keyPath: keyPath].keyPath)
}
// MARK: - KeyPath where Root: CoreStoreObject, Value: RelationshipContainer<Root>.ToOne<CoreStoreObject>
@@ -731,17 +577,6 @@ public func == <O, D>(_ keyPath: KeyPath<O, RelationshipContainer<O>.ToOne<D>>,
return Where<O>(O.meta[keyPath: keyPath].keyPath, isEqualTo: object)
}
/**
Creates a `Where` clause by comparing if a property is equal to a value
```
let dog = CoreStore.fetchOne(From<Dog>().where(\.master == nil))
```
*/
public func == <O, D>(_ keyPath: KeyPath<O, RelationshipContainer<O>.ToOne<D>>, _ null: Void?) -> Where<O> {
return Where<O>("%K == nil", O.meta[keyPath: keyPath].keyPath)
}
/**
Creates a `Where` clause by comparing if a property is not equal to a value
```
@@ -764,17 +599,6 @@ public func != <O, D>(_ keyPath: KeyPath<O, RelationshipContainer<O>.ToOne<D>>,
return !Where<O>(O.meta[keyPath: keyPath].keyPath, isEqualTo: object)
}
/**
Creates a `Where` clause by comparing if a property is not equal to a value
```
let dog = CoreStore.fetchOne(From<Dog>().where(\.master != nil))
```
*/
public func != <O, D>(_ keyPath: KeyPath<O, RelationshipContainer<O>.ToOne<D>>, _ null: Void?) -> Where<O> {
return Where<O>("%K != nil", O.meta[keyPath: keyPath].keyPath)
}
/**
Creates a `Where` clause by checking if a sequence contains a value of a property
```