File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,16 @@ try db.prepare("INSERT INTO Users (Name) VALUES (?)")
107
107
Add conformance to ` SQLRowDecodable ` to use convenience APIs for converting rows into your model entities.
108
108
109
109
``` swift
110
-
110
+ // Fetch all of the rows
111
+ let users = try db
112
+ .prepare (" SELECT Name, Level FROM Users ORDER BY Level ASC" )
113
+ .rows (User.self )
114
+
115
+ // Or only the next row
116
+ statement.row (User.self )
117
+
118
+ // Or the next N rows
119
+ statement.rows (User.self , count : 50 )
111
120
```
112
121
113
122
# Minimum Requirements
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public extension SQLStatement {
17
17
18
18
/// Fetches the first `count` rows returned by the statement. By default,
19
19
/// fetches all rows.
20
- func rows< T: SQLRowDecodable > ( count: Int ? = nil , _ type : T . Type ) throws -> [ T ] {
20
+ func rows< T: SQLRowDecodable > ( _ type : T . Type , count: Int ? = nil ) throws -> [ T ] {
21
21
var objects = [ T] ( )
22
22
let limit = count ?? Int . max
23
23
while let object = try row ( T . self) , objects. count < limit {
You can’t perform that action at this time.
0 commit comments