microlinkhq / keyvhq

Simple key-value storage with support for multiple backends.

Home Page:https://keyvhq.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose asyncIterable, keys(), values() and entries()

Jytesh opened this issue · comments

Need to do this for all storage adapters

  • Mongo
  • Redis
  • PostgreSQL
  • MySQL
  • SQLite

Thoughts on this one?

why this? iterate a large collection will perform very bad 🤔

Its probably the most requested feature for keyv, we can maybe expose this and not put it into keyv directly and let the end user get it if needed from store?

redis has scan, mongo has cursor, its the sql libs that dont expose some kind of chunked iteration

the iterator can be consumed with a for await loop, and extensions can use the iterator to get keys(), values() and entries(), which should be storage adaptor independent

Added key iterator, should add for values and entries as well? and maybe add some tests for those

Tests needed to get coverage back to acceptable levels

Thanks for all the effort 🙏