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

Generated code uses Go keyword resulting in a syntax error #2267

Closed
J404J opened this issue May 6, 2023 · 0 comments · Fixed by #2849
Closed

Generated code uses Go keyword resulting in a syntax error #2267

J404J opened this issue May 6, 2023 · 0 comments · Fixed by #2849
Labels
📚 mysql bug Something isn't working 🔧 golang
Milestone

Comments

@J404J
Copy link

J404J commented May 6, 2023

Version

v1.18.0

What happened?

MySQL
config : query_parameter_limit= 3

mysql table has field named switch, then gen code will like this:

func (q *Queries) GetSomething(ctx context.Context, name string, switch SomethingSwitch) (*Something, error) 

but switch is golang keyword. Does sqlc need to be compatible with this situation?

Playground URL

https://play.sqlc.dev/p/3f5d54e71a2309b4fa02b40cb1d2322f9eccf6359cac47d3b22371a6628baea2

@J404J J404J added bug Something isn't working triage New issues that hasn't been reviewed labels May 6, 2023
@kyleconroy kyleconroy added 🔧 golang 📚 mysql and removed triage New issues that hasn't been reviewed labels Jun 6, 2023
@kyleconroy kyleconroy changed the title The mysql field contains the go keyword, and it is used as a query parameter, an error will be generated Generated code uses Go keyword resulting in a syntax error Sep 26, 2023
@kyleconroy kyleconroy added this to the 1.23.0 milestone Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 mysql bug Something isn't working 🔧 golang
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants