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

Add JoinOn and GroupJoinOn query methods #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

derino
Copy link

@derino derino commented May 23, 2022

No description provided.

@ahmetb
Copy link
Owner

ahmetb commented Jun 1, 2022

Are there .NET equivalents of these? We mostly maintain the symmetry.

@derino
Copy link
Author

derino commented Jun 1, 2022

No there aren't. Though, I think they enable more concise code where the intent is more clear.

This is how ( e1 ) . JoinOn( e2, predicatefn ) could be implemented with the existing methods:

( e1 ) . SelectManyBy( x1 => e2 , ( x1 , x2 ) => new { x1 , x2 } ) . Where( predicatefn )

where the predicate function takes a pair and returns boolean.

Similarly, ( e1 ) . GroupJoinOn( e2, predicatefn, resultSelector ) is equivalent to:

( e1 ) . SelectManyBy( x1 => e2 , ( x1 , x2 ) => new { x1 , x2 } ) . Where( predicatefn ) . GroupBy( { x1, x2 } => x1, { x1, x2 } => x2 ) . Select( resultSelector )

Of course these are much more verbose when written in Go.

Maybe it would be more consistent with the rest of LINQ if they were named JoinBy and GroupJoinBy. I can change that if you think so.

If you are strict with symmetry, please don't hesitate to close the PR.

P.S.: Thanks for this package!

@ahmetb
Copy link
Owner

ahmetb commented Jun 6, 2022

I think we've been largely maintaining the symmetry with .NET. Other maintainers can also chime in if they feel like this is needed.

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

Successfully merging this pull request may close these issues.

None yet

2 participants