Documentation

This commit is contained in:
Gwendal Roué committed 2017-08-19 10:13:40 +02:00
1 parent e111529035
commit 3c4ff587ca
1 file changed
+5 -4
+5 -4
View File
@@ -1845,10 +1845,11 @@ let persons = try Person.fetchAll(db, "SELECT ...", arguments: ...) // [Person]
Add the [TableMapping](#tablemapping-protocol) protocol and you can stop writing SQL:
```swift
let persons = try Person.filter(emailColumn != nil).order(nameColumn).fetchAll(db) // [Person]
let person = try Person.fetchOne(db, key: 1) // Person?
let person = try Person.fetchOne(db, key: ["email": "arthur@example.com"]) // Person?
let countries = try Country.fetchAll(db, keys: ["FR", "US"]) // [Country]
let spain = try Country.fetchOne(db, key: "ES") // Country?
let persons = try Person // [Person]
.filter(Column("email") != nil)
.order(Column("name"))
.fetchAll(db)
```
See [fetching methods](#fetching-methods), and the [query interface](#the-query-interface).