File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -812,15 +812,24 @@ It is therefore recommended using the `RowIterator` API instead,
812812which has explicit error handling:
813813
814814` ` ` swift
815+ // option 1 : convert results into an Array of rows
815816let rowIterator = try db.prepareRowIterator(users)
816817for user in try Array (rowIterator) {
817818 print (" id: \( user[id]), email: \( user[email])" )
818819}
819820
820- / // or using ` map()`
821+ /// option 2 : transform results using ` map()`
821822let mapRowIterator = try db.prepareRowIterator(users)
822823let userIds = try mapRowIterator.map { $0 [id] }
823824
825+ /// option 3 : handle each row individually with ` failableNext()`
826+ do {
827+ while let row = try rowIterator.failableNext() {
828+ // Handle row
829+ }
830+ } catch {
831+ // Handle error
832+ }
824833```
825834
826835### Plucking Rows
You can’t perform that action at this time.
0 commit comments