Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range search for localstorage and session storage #10411

Closed
anuragvohraec opened this issue Jun 14, 2024 · 7 comments
Closed

Range search for localstorage and session storage #10411

anuragvohraec opened this issue Jun 14, 2024 · 7 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@anuragvohraec
Copy link

anuragvohraec commented Jun 14, 2024

What problem are you trying to solve?

Storage interface of the WebStorage API should have a range search feature to pull out multiple value out of Storage interface.

What solutions exist today?

None

How would you solve it?

Solutions:

  1. Add getItems method to storage interface
Storage.getItems(lowerKey,upperKey,lowerOpen,upperOpen,direction);
  1. Add nextKey and prevKey methods to storage interface.
Storage.nextKey(key1);//this will give next key after the key1
Storage.prevKey(key1);//this will give prev key before the key1

Anything else?

No response

@anuragvohraec anuragvohraec added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Jun 14, 2024
@nektro
Copy link

nektro commented Jun 14, 2024

do you have a fuller example of what you're trying to accomplish and how the current api falls short?

@anuragvohraec
Copy link
Author

do you have a fuller example of what you're trying to accomplish and how the current api falls short?

I wanted to fetch out a range of values from Storage interface. For example get me all values in between fruit-apple and fruit-orange.
One can't do that with the current Storage interface as it allows only pulling out single value using getItem.

So I suggest we should have a feature to pull out range of values out of Storage interface.

@annevk
Copy link
Member

annevk commented Jun 17, 2024

Are there any libraries that offer this functionality and how popular are they?

In general though I would not expect us to add much new functionality to localStorage or sessionStorage as they unfortunately offer synchronous I/O which is not great for performance.

@smaug----
Copy link

Indeed. I'd rather have some reasonable API on top of IndexedDB, or make IndexedDB itself easy to use.

@anuragvohraec
Copy link
Author

Are there any libraries that offer this functionality and how popular are they?

There are no libs to work on top of Storage api. As the underlying lib do not have any kind of iterators or complex search feature themselves.

@anuragvohraec
Copy link
Author

Indeed. I'd rather have some reasonable API on top of IndexedDB, or make IndexedDB itself easy to use.

yeah IDB can be used, but cases where Storage(local/session) is needed there in we do not have some complex search features to help out.

@domenic
Copy link
Member

domenic commented Jun 20, 2024

Let's close this, as we have signals from multiple implementers that the sync storage APIs are not going to be extended.

@domenic domenic closed this as completed Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

5 participants