only-cliches/snap-db

Could we also add a `queryKeysIt()` method with the `QueryArgs` optoins?

huan opened this issue · 2 comments

huan commented

According to #1 (comment), I would like to have a queryKeysIt() so that I can get the keys by a queryArgs.

Currently, I have to get an iterator of both [key, value] and filter out the key. If we can have the queryKeysIt with a queryArgs, then I'll be able to filter out the keys I needed, and I guess that would be a huge improvement of the performance (because all the keys are in memory)?

You can already do this with array destructuring.

const data = await db.queryIt({values: false});
for await (const [key, value] of data) {
    console.log(key);
}
huan commented

Fantastic!

Thanks for this awesome API. 😄