Open tswaters opened 7 years ago
Hey, great idea! I like it! If I have some time in the future I will look into it. Feel free to branch from Master if you like add send a pull request :). In anyway I will keep it open as a note for me to possibly return back to it.
I was looking at this too as I had name collision in some of the joins I was doing. You can get around it today by simply taking a two-step approach...
Using your code as the example...
var dogs = new jinqJs()
.from(data.dogs)
.select([{
field: human
}, {
field: name,
text: dogName
}]);
new jinqJs()
.from(data.humans)
.join(dogs)
.on((human, dog) => human.id === dog.human)
.select()
This should get you what you want (with the added field of dog.human)
This is a pretty cool library, looks really awesome.
I'm curious if there is any plan to support alias names? Right now data from multiple joins include the same field names, the result that is emitted for each row has everything clobbered together.
e.g.,
It would be really cool if I could do something like the following:
Of course, if this was possible one should be able to reference these aliases in other clauses as well.
I'm not sure about the API, maybe something like this:
Looking through the code a bit, it wouldn't exactly be a trivial update to implement this, so feel free to close this ticket with extreme prejudice, but ... it would be pretty cool 😄