Conversation
Make `Result` automatically iterable, so one can iterate through data without having to access `rows` explicitly:
```js
client.query('select...', (err, res) => {
// below we can use just "res", not "res.rows"
for(const a of res) {
console.log(a); // print the row
}
})
```
|
In an afterthought, it would make the library perform better, if This PR above is a first step toward that. For now, it just forwards into The bottom line, modern development practices gravitate toward iterables versus pre-built lists. |
This is to align with [this main-driver change](brianc/node-postgres#2861). The two PR-s should be merged at the same time.
|
I don’t think this is worth changing now.
It’s nice when there’s just one way to do it. |
|
This caters for all coding styles, without any change in functionality. It also opens a path to changing types conversion, to become dynamic. There are lots of libraries these days that handle iterables well. |
Make
Resultautomatically iterable, so one can iterate through rows without having to accessrowsexplicitly:This also simplifies data processing when you want to process it as just iterable, all the way, not as an array.