Open scottohara opened 5 years ago
Just as .iterate() is a convenience for .openCursor() (avoids the need for an if (cursor) ... check for when the cursor returns no results),
.iterate()
.openCursor()
if (cursor) ...
...should there also be an equivalent .iterateKeys() as a similar convenience for .openKeyCursor()?
.iterateKeys()
.openKeyCursor()
Currently to async-iterate over the keys of a store or index, it seems like the only option is:
let cursor = await store.openKeyCursor(); if (cursor) for await (const cursor of cursor) { // use cursor.key here... }
For symmetry, it would seem like this may also be useful:
for await (const cursor of store.iterateKeys()) { // use cursor.key here... }
Yeah, that seems fair
Just as
.iterate()
is a convenience for.openCursor()
(avoids the need for anif (cursor) ...
check for when the cursor returns no results),...should there also be an equivalent
.iterateKeys()
as a similar convenience for.openKeyCursor()
?Currently to async-iterate over the keys of a store or index, it seems like the only option is:
For symmetry, it would seem like this may also be useful: