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 INNER as a JoinOption #56

Closed
rw-access opened this issue Dec 22, 2020 · 3 comments · Fixed by #57
Closed

Add INNER as a JoinOption #56

rw-access opened this issue Dec 22, 2020 · 3 comments · Fixed by #57

Comments

@rw-access
Copy link
Contributor

I've run into a use case that could be made simpler with another JoinOption available.

I'm dynamically generating SQL queries and conditionally change from JOIN to LEFT JOIN. Since an unmodified JOIN is equivalent to INNER JOIN then I realized that I could use JoinWithOption, and conditionally change the JoinOption.

There are a few obvious options Ito do this:

  • Conditionally call either Join or JoinWIthOption, with a JoinOption to the second
  • Create my own const JoinOption that's just the word "INNER". Then I'll conditionally just use a package constant Inner or the imported constant sqlbuilder.LeftJoin. It's a little inconsistent, but not bad
  • Add a new const Inner JoinOption = "INNER" to the library

Any thoughts on the last option? I figured it's an easy and reasonable addition.
I can create a PR if you think it's a good path forward for the library.

@huandu
Copy link
Owner

huandu commented Dec 22, 2020

I agree. Adding a new const InnerJoin can improve readability. Please submit a PR for it. Welcome to contribute.

@rw-access
Copy link
Contributor Author

Will do.
I just recently started with this library and I'm enjoying it. Thanks!

@huandu
Copy link
Owner

huandu commented Dec 22, 2020

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants