mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Fix RowAdapter documentation
This commit is contained in:
1 parent
85d640c4f8
commit
7b9d54183c
1 file changed
+3
-2
@@ -1236,11 +1236,12 @@ row.value(named: "consumed") // "Hello"
|
||||
**Row adapters can also define "sub rows".** Sub rows help several consumers feed on a single row:
|
||||
|
||||
```swift
|
||||
let sql = "SELECT books.*, persons.name AS authorName " +
|
||||
let sql = "SELECT books.id, books.title, books.authorID, " +
|
||||
" persons.name AS authorName " +
|
||||
"FROM books " +
|
||||
"JOIN persons ON books.authorID = persons.id"
|
||||
|
||||
let authorMapping = ["authorID": "id", "authorName": "name"]
|
||||
let authorMapping = ["id": "authorID", "name": "authorName"]
|
||||
let adapter = RowAdapter(subrows: ["author": authorMapping])
|
||||
|
||||
for row in Row.fetch(db, sql, adapter: adapter) {
|
||||
|
||||
Reference in new issue
Block a user