You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-8Lines changed: 24 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -250,8 +250,8 @@ See [Records](#records)
250
250
251
251
```swift
252
252
try dbQueue.read { db in
253
-
// Place?
254
-
let paris = try Place.fetchOne(db, id: 1)
253
+
// Place
254
+
let paris = try Place.find(db, id: 1)
255
255
256
256
// Place?
257
257
let berlin = try Place.filter(Column("title") == "Berlin").fetchOne(db)
@@ -2517,6 +2517,7 @@ let bestPlayers = try Player // [Player]
2517
2517
.fetchAll(db)
2518
2518
2519
2519
let spain = try Country.fetchOne(db, id: "ES") // Country?
2520
+
let italy = try Country.find(db, id: "IT") // Country
2520
2521
```
2521
2522
2522
2523
:point_right: Fetching from raw SQL is available for subclasses of the [Record](#record-class) class, and types that adopt the [FetchableRecord] protocol.
When `id` has a [database-compatible type](#values) (Int64, Int, String, UUID, ...), the `Identifiable` conformance unlocks type-safe record and request methods:
3279
3280
3280
3281
```swift
3281
-
let player = try Player.fetchOne(db, id: 1)
3282
-
let players = try Player.fetchAll(db, ids: [1, 2, 3])
3283
-
let players = try Player.fetchSet(db, ids: [1, 2, 3])
3282
+
let player = try Player.find(db, id: 1) // Player
3283
+
let player = try Player.fetchOne(db, id: 1) // Player?
All record types can use `fetchOne(_:key:)`, `fetchAll(_:keys:)` and `fetchSet(_:keys:)` that apply conditions on primary and unique keys:
5308
+
All record types can use `find(_:key:)`, `fetchOne(_:key:)`, `fetchAll(_:keys:)` and `fetchSet(_:keys:)` that apply conditions on primary and unique keys:
0 commit comments