Skip to content

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

Closed
@J404J

Description

@J404J

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions