-
Notifications
You must be signed in to change notification settings - Fork 7
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
Multiple keys #7
Comments
I think it may be confused for users, they need to remember whether these keys mean |
I think "composite key" or "compound key" is common concept in database? |
I think multiple keys aligning with a composite key from databases is a good concept to have. In the example given here however, the last in was taken as the value to keep. Where in the current typical cases shows the first in being the value and once set not overwritten. For consistency My only other concern to flush out is how would If a reasonable solution to undefined/null can't be figured out, then I don't see why we should include this in JS. I'd much prefer we introduced easy to reason about basics in the language while allowing developers to do anything more advanced they want. Which the composite key thing totally is with a custom function. I think the difficult issue is context with these values. In one context a developer may say, "I don't care about anything with those values in a key, leave it out of the resulting array since they can't be guaranteed unique." While in another context it may be, "I only want the best attempt at full uniqueness. If anything is missing, take the first whole compatible object and move on." So the same composite key scenario could be applied in different ways in our world. How do we rectify this without some extra option parameter? |
Let's discuss it in #18 . |
I raise this issue because there is no simple way to deal with multiple key. But maybe it could be solved by leverage the new tuple/record proposal, though we need to figure out how to handle object reference in tuple/record. attrUpdates.unique(v => #[v.node, v.attr]); // not work now, because v.node are objects |
It's common to have multiple keys for unique, so let's also support Array<number|string|symbol> for the param:
The text was updated successfully, but these errors were encountered: