Skip to content

Commit 806cc2c

Browse files
committed
Fix cursor docs
1 parent 889a0ca commit 806cc2c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ Use cursors if you need to throttle the amount of rows being returned from a que
162162

163163
```js
164164

165-
await sql.cursor`
165+
await sql`
166166
select * from generate_series(1,4) as x
167-
`.cursor(row => {
167+
`.cursor(async row => {
168168
// row = { x: 1 }
169-
http.request('https://example.com/wat', { row })
169+
await http.request('https://example.com/wat', { row })
170170
})
171171

172172
// No more rows
@@ -177,9 +177,9 @@ A single row will be returned by default, but you can also request batches by se
177177

178178
```js
179179

180-
await sql.cursor`
180+
await sql`
181181
select * from generate_series(1,1000) as x
182-
`.cursor(10, rows => {
182+
`.cursor(10, async rows => {
183183
// rows = [{ x: 1 }, { x: 2 }, ... ]
184184
await Promise.all(rows.map(row =>
185185
http.request('https://example.com/wat', { row })
@@ -194,7 +194,7 @@ You can also stop receiving any more rows early by returning an end token `sql.E
194194

195195
```js
196196

197-
await sql.cursor`
197+
await sql`
198198
select * from generate_series(1,1000) as x
199199
`.cursor(row => {
200200
return Math.random() > 0.9 && sql.END

0 commit comments

Comments
 (0)