StatementSyncIterator
TypeIterates over the rows of a statement, as returned by StatementSync.iterate(). It's a
standard JS iterator, so it works with for...of, spread syntax and iterator helpers.
Properties
This type has no properties.
Methods
next() -> object
Reads the next row.
Declaration
next() -> { done: boolean, value: any }
Returns
object
The next row as
value, or done: true (with value null) once there are no more rows| Field | Type | Description |
|---|---|---|
| done | boolean | |
| value | any |
Example
const rows = db.prepare('SELECT * FROM notes').iterate()
const first = rows.next().value
return() -> object
Stops iterating, releasing the statement. for...of calls this when the loop exits early.
Declaration
return() -> { done: boolean, value: any }
Returns
object
{ done: true, value: null }| Field | Type | Description |
|---|---|---|
| done | boolean | |
| value | any |
Example
rows.return()