mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-21 08:21:21 +02:00
allow ObjectSnapshot and ObjectPublisher as parameter to Where clauses
This commit is contained in:
@@ -267,6 +267,17 @@ public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, D>
|
|||||||
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: objectID)
|
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: objectID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a `Where` clause by comparing if a property is equal to a value
|
||||||
|
```
|
||||||
|
let dog = dataStack.fetchOne(From<Dog>().where(\.master == john))
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
public func == <O: ObjectRepresentation, D: NSManagedObject>(_ keyPath: KeyPath<O, D>, _ object: O) -> Where<O> where O.ObjectType: NSManagedObject {
|
||||||
|
|
||||||
|
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object.cs_id())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a `Where` clause by comparing if a property is not equal to a value
|
Creates a `Where` clause by comparing if a property is not equal to a value
|
||||||
```
|
```
|
||||||
@@ -278,6 +289,17 @@ public func != <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, D>
|
|||||||
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: objectID)
|
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: objectID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a `Where` clause by comparing if a property is not equal to a value
|
||||||
|
```
|
||||||
|
let dog = dataStack.fetchOne(From<Dog>().where(\.master != john))
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
public func != <O: ObjectRepresentation, D: NSManagedObject>(_ keyPath: KeyPath<O, D>, _ object: O) -> Where<O> where O.ObjectType: NSManagedObject {
|
||||||
|
|
||||||
|
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object.cs_id())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a `Where` clause by checking if a sequence contains a value of a property
|
Creates a `Where` clause by checking if a sequence contains a value of a property
|
||||||
```
|
```
|
||||||
@@ -303,6 +325,17 @@ public func == <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Op
|
|||||||
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object)
|
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a `Where` clause by comparing if a property is equal to a value
|
||||||
|
```
|
||||||
|
let dog = dataStack.fetchOne(From<Dog>().where(\.master == john))
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
public func == <O: ObjectRepresentation, D: NSManagedObject>(_ keyPath: KeyPath<O, Optional<D>>, _ object: O?) -> Where<O> where O.ObjectType: NSManagedObject {
|
||||||
|
|
||||||
|
return Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object?.cs_toRaw())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a `Where` clause by comparing if a property is not equal to a value
|
Creates a `Where` clause by comparing if a property is not equal to a value
|
||||||
```
|
```
|
||||||
@@ -314,6 +347,17 @@ public func != <O: NSManagedObject, D: NSManagedObject>(_ keyPath: KeyPath<O, Op
|
|||||||
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object)
|
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates a `Where` clause by comparing if a property is not equal to a value
|
||||||
|
```
|
||||||
|
let dog = dataStack.fetchOne(From<Dog>().where(\.master != john))
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
public func != <O: ObjectRepresentation, D: NSManagedObject>(_ keyPath: KeyPath<O, Optional<D>>, _ object: O?) -> Where<O> where O.ObjectType: NSManagedObject {
|
||||||
|
|
||||||
|
return !Where<O>(keyPath._kvcKeyPathString!, isEqualTo: object?.cs_toRaw())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a `Where` clause by checking if a sequence contains a value of a property
|
Creates a `Where` clause by checking if a sequence contains a value of a property
|
||||||
```
|
```
|
||||||
@@ -690,6 +734,17 @@ public func == <O, D: FieldRelationshipToOneType>(_ keyPath: KeyPath<O, FieldCon
|
|||||||
return Where<O>(O.meta[keyPath: keyPath].keyPath, isEqualTo: object)
|
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 = dataStack.fetchOne(From<Dog>().where(\.master == john))
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
public func == <O, D: FieldRelationshipToOneType, R: ObjectRepresentation>(_ keyPath: KeyPath<O, FieldContainer<O>.Relationship<D>>, _ object: R?) -> Where<O> where D.DestinationObjectType == R.ObjectType {
|
||||||
|
|
||||||
|
return Where<O>(O.meta[keyPath: keyPath].keyPath, isEqualTo: object?.objectID())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a `Where` clause by comparing if a property is equal to a value
|
Creates a `Where` clause by comparing if a property is equal to a value
|
||||||
```
|
```
|
||||||
@@ -723,6 +778,17 @@ public func != <O, D: FieldRelationshipToOneType>(_ keyPath: KeyPath<O, FieldCon
|
|||||||
return !Where<O>(O.meta[keyPath: keyPath].keyPath, isEqualTo: object)
|
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 = dataStack.fetchOne(From<Dog>().where(\.master != john))
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
public func != <O, D: FieldRelationshipToOneType, R: ObjectRepresentation>(_ keyPath: KeyPath<O, FieldContainer<O>.Relationship<D>>, _ object: R?) -> Where<O> where D.DestinationObjectType == R.ObjectType {
|
||||||
|
|
||||||
|
return !Where<O>(O.meta[keyPath: keyPath].keyPath, isEqualTo: object?.objectID())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates a `Where` clause by comparing if a property is not equal to a value
|
Creates a `Where` clause by comparing if a property is not equal to a value
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user