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

Future: Support Tuples as compound keys #390

Open
inexorabletash opened this issue Aug 19, 2022 · 1 comment
Open

Future: Support Tuples as compound keys #390

inexorabletash opened this issue Aug 19, 2022 · 1 comment
Labels
external dependency feedback wanted TPAC2024 Topic for discussion at TPAC 2024

Comments

@inexorabletash
Copy link
Member

Assuming the Record & Tuple proposal lands in ECMAScript, we should support specifying composite keys with tuples. Namely things like this would be expected to work:

// tuples and arrays are equally valid ways to specify composite keys
assert(indexedDB.cmp([1,2,3], #[1,2,3]) === 0);

// tuples and arrays are interchangeable where keys are used
store.put('value1', #[1,2,3]); 
store.put('value2', [4,5,6]); 
store.get([1,2,3]).onsuccess = e => { assert(e.target.result === 'value1'; };
store.get(#[4,5,6]).onsuccess = e => { assert(e.target.result === 'value2'; };

// but IndexedDB operations that return composite keys to script still produce arrays
store.put('value', #[1,2,3]).onsuccess = e => { let key = e.target.result; assert(Array.isArray(key)); };

I believe this would only require normative changes in https://w3c.github.io/IndexedDB/#convert-value-to-key and an non-normative changes in https://w3c.github.io/IndexedDB/#key-construct

@inexorabletash
Copy link
Member Author

Also, I'd want to resolve #360 first (just an editorial change, though - no normative behavior differences)

@w3c w3c deleted a comment from Cklim143 Jan 25, 2023
@w3c w3c deleted a comment from Line2588 Jul 25, 2023
@w3c w3c deleted a comment from Line2588 Jul 25, 2023
@SteveBeckerMSFT SteveBeckerMSFT added the TPAC2024 Topic for discussion at TPAC 2024 label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external dependency feedback wanted TPAC2024 Topic for discussion at TPAC 2024
Projects
None yet
Development

No branches or pull requests

2 participants