Skip to content

Conversation

@avalonbits
Copy link
Contributor

@avalonbits avalonbits commented Apr 16, 2022

This situation can occur if the column name starts with an underscore prefix and the following character is a digit:

create table thing (
 _1099Form text
);

currently the generator would balk because the generated struct would be :

type Thing struct {
  1099Form string
}

and 1099Form is not a valid name (it starts with a digit).

with this change we would instead get instead:

type Thing struct {
  _1099Form string
}

Copy link
Collaborator

@kyleconroy kyleconroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the code! If the tests pass, I'll merge (and add a test too)

@kyleconroy kyleconroy merged commit 52b6bb4 into sqlc-dev:main Apr 22, 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