TryGhost / node-sqlite3

SQLite3 bindings for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

streaming support / generator functions

ds2345 opened this issue · comments

Summary

is there a way to fetch results of select statement one by one, instead of all at once, by using javascript generator functions?
(those functions that internally use yield statement)

I am aware that .each() function can handle reading rows one by one by using callbacks,
but callbacks get complicated when used in async/await environment.
I tried converting ".each()" callbacks to promise and to generator function, but so far this didn't work.

So are generator functions already possible (and how), or could they be added to the core library?

Proposed implementation

something like

function* selectEach(query, params = []) ...