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

fix: fix toSnakeCase to handle input in camel case format #2245

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

orisano
Copy link
Contributor

@orisano orisano commented Apr 30, 2023

fix #2243

Previously, SetCaseStyle was used only for column names (snake case), so the toSnakeCase function worked correctly with strings.ToLower only.

Convert the model name (camel case) to snake case to get the tag name used in sqlc.embed.
This breaks the precondition of the toSnakeCase function and it no longer works correctly.

So we fixed the toSnakeCase function to work correctly even if the input is camel case.

If the proposed fix approach is incorrect, please let me know and feel free to close this PR

@orisano orisano changed the title fix: fix toSnakeCase to handle input in CamelCase format fix: fix toSnakeCase to handle input in camel case format Apr 30, 2023
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.

This will be a breaking change, but it's most certainly the correct behavior.

@kyleconroy kyleconroy merged commit a5b691c into sqlc-dev:main Jun 6, 2023
6 checks passed
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.

json_tags_case_style not working properly when using sqlc.embed
2 participants