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

fix: auto add alias for order column added via Column() method if the colu… #939

Closed
wants to merge 5 commits into from

Conversation

ilxqx
Copy link

@ilxqx ilxqx commented Dec 11, 2023

Auto add alias for order column added via Column() method if the column in the table FieldMap

@vmihailenco
Copy link
Member

This requires better explanation of what you are trying to achieve and what are the alternatives. TBH I am not big fan of having queries the result of which depend on the previous state of FieldMap... It probably will be too brittle...

@vmihailenco vmihailenco added the question Further information is requested label Jan 6, 2024
@ilxqx
Copy link
Author

ilxqx commented Jan 6, 2024

If I have a SQL query with multiple table joins, when I specify to sort by Order, if it's the sorting field of the main table, I'll omit the table alias; if it's a sorting field from other joined tables, then I will directly specify the alias.field_name.

This semantic is consistent with the Column method and I think this better reflects its practical meaning for framework users.

@vmihailenco
Copy link
Member

@ilxqx okay, could you please update query_test.go with some examples that demonstrate your point?

@ilxqx ilxqx closed this Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants