Skip to content

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 force-pushed the fix-improve-snake branch from ee030b7 to 2d136f1 Compare April 30, 2023 15:07
@orisano orisano changed the title fix: fix toSnakeCase to handle input in CamelCase 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
alfonsodev pushed a commit to ExponentiaTeam/sqlc that referenced this pull request Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants