Skip to content

Couldn't find option to disable upppercase ID for every _id field #2161

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

Closed
priyanshujain opened this issue Mar 20, 2023 · 4 comments · Fixed by #3308
Closed

Couldn't find option to disable upppercase ID for every _id field #2161

priyanshujain opened this issue Mar 20, 2023 · 4 comments · Fixed by #3308
Labels
enhancement New feature or request 🔧 golang
Milestone

Comments

@priyanshujain
Copy link

I can see that sqlc create ID for every _id field suffix. Is there any parameter so that it generated capitalized Id instead of uppercase ID suffix.

For ex. currently it does

app_id      -> AppID

I want to do

app_id      -> AppId

@kyleconroy Please help here.

@priyanshujain
Copy link
Author

As I can see here, There is intentional modification of id to ID. Can you please help me understand the reason behind it? Thanks!

@sergey-tb
Copy link

sergey-tb commented Mar 26, 2023

@priyanshujain , it is because of this silly naming convention rule in Go.

In reality people rarely follow it, due to KpmgWsUrl is easier to read than KPMGWSURL. However, sqlc also doesn't follow all acronyms, except for some reasons for ID. You may try this setting, but it seems not a wildcard so you will need to do it for all IDs.

@priyanshujain
Copy link
Author

@sergey-tb Thanks. If I use renaming settings conf then it's a never-ending amount of work.

Is it worth building a feature skipping initialisms for sqlc? As It says in go wiki

The code generated by the protocol buffer compiler is exempt from this rule. Human-written code is held to a higher standard than machine-written code.

And as go devs say - There's a never-ending list, we'll get it wrong, and it's simpler to stick with the current mechanical translation. (link)

Please let me know your thoughts. cc: @kyleconroy

@sergey-tb
Copy link

sergey-tb commented Mar 26, 2023

@priyanshujain , I'm not a contributor of sqlc, but for sure agree initialism should be configured. I like how some linters do it, eg: initialism : ["id","url"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🔧 golang
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants