Skip to content

Commit e056f9e

Browse files
committed
README
1 parent 61d6cdc commit e056f9e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CDQI uses the [PredicateQI](https://github.com/prosumma/PredicateQI) (PQI) packa
1010

1111
- [x] [Fluent interface](http://en.wikipedia.org/wiki/Fluent_interface), i.e., chainable methods
1212
- [x] Large number of useful overloads
13-
- [x] Type-safety in filter comparisons.
13+
- [x] Type-safety — really, type guidance (see below) — in filter comparisons.
1414
- [x] Filtering, sorting, grouping, aggregate expressions, limits, etc.
1515
- [x] Optionally eliminates the use of magic strings so common in Core Data
1616
- [x] Query reuse, i.e., no side-effects from chaining
@@ -36,9 +36,12 @@ class Developer: NSManagedObject {
3636
}
3737
```
3838

39-
Given this data model, we can start making some queries:
39+
Given this data model, we can start making some queries. But first, remember to `import PredicateQI`! Without this import, the compiler magic that allows the comparison expressions to be translated into the `NSPredicate` language won't work and in most cases you'll get mysterious compilation errors.
4040

4141
```swift
42+
import CoreDataQueryInterface
43+
import PredicateQI
44+
4245
// Which languages are known by at least two of the developers?
4346
// developers.@count >= 2
4447
Query(Language.self).filter { $0.developers.pqiCount >= 2 }
@@ -51,6 +54,9 @@ Query(Language.self).filter { any(ci($0.developers.lastName %* "*s*")) }
5154
We can get the `NSFetchRequest` produced by the query by asking for its `fetchRequest` property. But it's usually easier just to execute the fetch request directly:
5255

5356
```swift
57+
import CoreDataQueryInterface
58+
import PredicateQI
59+
5460
let cooldevs = try Query(Developer.self)
5561
.filter {
5662
// ANY languages.name IN {"Rust","Haskell"}

0 commit comments

Comments
 (0)