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

How do I declare a multi-property index? #23

Open
retorquere opened this issue Sep 15, 2024 · 5 comments
Open

How do I declare a multi-property index? #23

retorquere opened this issue Sep 15, 2024 · 5 comments
Assignees

Comments

@retorquere
Copy link

I have a store that has an index on two combined properties, how do I declare this index?

@n1md7
Copy link
Owner

n1md7 commented Sep 15, 2024

Hello, can you provide an example of how you are using it?

@retorquere
Copy link
Author

I'm not using it yet, but in indexedDB terms I'm trying to create

db.createObjectStore('BetterBibTeX', { keyPath: [ 'context', 'itemID' ]}),

and

store.createIndex('context-itemID', [ 'context', 'itemID' ], { unique: true })

@n1md7
Copy link
Owner

n1md7 commented Sep 15, 2024

This functionality isn't currently supported by my library, and I wasn't aware that compound indexes were available in the IndexedDB API. Could you share the source where I can find more details on this? I've been using this as my primary reference: MDN Web Docs - IDBObjectStore.createIndex.

I'll look into adding support for it.

@retorquere
Copy link
Author

From that same page:

Note that it is possible to create an index with an empty keyPath, and also to pass in a sequence (array) as a keyPath.

@n1md7
Copy link
Owner

n1md7 commented Sep 15, 2024

Okay, thank you. I'll look into it. And I'll add support for that any time soon.

@n1md7 n1md7 self-assigned this Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants