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

feat: escape query struct keywords #630

Merged
merged 2 commits into from
Sep 2, 2022
Merged

Conversation

clouds56
Copy link
Contributor

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

  • add func (b *QueryStructMeta) ReviseFieldNameFor(keywords model.KeyWord) that could specify keyword list
  • add a new KeyWord DOKeywords contains Alias, TableName, WithContext
  • apply DOKeywords every time call (g *Generator) apply

User Case Description

I have field named alias in my table, and it could not compile after generating query (conflict with func Alias).
Of course I could add things like gen.FieldRename("alias", "ALIAS") in my generating code, but I think it should work out of box.

@tr1v3r tr1v3r changed the title fix escape keyword for alias feat: escape query struct keywords Sep 2, 2022
@tr1v3r tr1v3r merged commit 9f51104 into go-gorm:master Sep 2, 2022
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.

2 participants