Closed natasha-jarus closed 1 year ago
I like to work on this bug, please assign me.
My Solution: In this if, we check Params.Column.name to see if it is a golang specific keywords or not. If it is, we should capitalize it.
if len(query.Params) == 1 { p := query.Params[0] gq.Arg = QueryValue{ Name: paramName(p), Typ: goType(r, p.Column, settings), SQLPackage: sqlpkg, } }
Golang Specific Keywords are defined here.
Hi do you have already a fix for this problem ?
Hi, I checked the code base, My suggestion was applied to the code. It should be fixed now. I don't know why issue still is open.
Version
1.10.0
What happened?
If you create a query with a single positional parameter whose inferred arg name is a go keyword (e.g.,
WHERE type = $1
), sqlc reports a generation error:Adding a second query parameter allows the code generation to succeed. Currently the workaround is to use an explicitly named parameter (e.g.,
WHERE type = @my_type
).Relevant log output
No response
Database schema
No response
SQL queries
Configuration
No response
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go