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

Cursor support #25

Open
cquiroz opened this issue May 17, 2022 · 7 comments
Open

Cursor support #25

cquiroz opened this issue May 17, 2022 · 7 comments

Comments

@cquiroz
Copy link

cquiroz commented May 17, 2022

Would it be possible to support openCursor and openKeyCursor operations?
It maybe a bit odd since you can run effects while traversing the cursor like delete

@japgolly
Copy link
Owner

FYI it'll be a while before I time to implement this. Sorry. PRs welcome though, of course

@japgolly
Copy link
Owner

Hey FYI I had a try at this over the weekend, looks like it's not going to be as time-consuming as I thought. I'll chip away at this when I have free time and get it in before 2.0.0 final

@japgolly
Copy link
Owner

Hey @cquiroz, are you doing this off an object store directly, or an index?

@cquiroz
Copy link
Author

cquiroz commented May 23, 2022

I haven't done it yet but I was hopin to traverse an object store looking to member of the value.
I think that's done with an index, right?

@japgolly
Copy link
Owner

It seems indices are optional. You can open cursors on the entire object store and traverse all keys & values without an index. I haven't used IDB indices before but it seems like indices are only needed if you want specific ordering of cursor results, and/or you want to be able to jump backwards and forwards by key. (?)

@rpiaggio
Copy link

Hi! I'm trying to use this functionality too.

You can open a ranged cursor over the store key, which is what I'm trying to do; see here: https://developer.mozilla.org/en-US/docs/Web/API/IDBKeyRange#examples

Would you mind sharing what you have so far so we can see if we can build upon it and send a PR?

@japgolly
Copy link
Owner

Hey @rpiaggio ! Yeah absolutely, I just pushed a topic/idbIndices now.

I don't remember the details, just that it became more complex that I expected. Or maybe I got a PoC working but once I saw the unit test, I didn't like the DSL? 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants