-
Notifications
You must be signed in to change notification settings - Fork 789
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
Unexpected struct name when a table name ends with 'meta' #1892
Comments
This is not an urgent issue as it doesn't hinder progress, I just thought it was a bit bizarre and wanted to flag it. |
Also an issues with media This one isn't a huge issue, I just have to remember to use the right name and to switch back when it's fixed. So in my migration schema, I have a couple structs that have media in them:
I 'made' a playground for this, but realistically all I did was change authors to name_media and it happens. https://play.sqlc.dev/p/fe32fa791d8da82e238e014619ebfa9fefbfa3fa2bceaa363c2f40fdbba55b9b |
You can actually fix this, but you have to know which key to use in the rename configuration. For {
"version": "1",
"rename": {
"bazaar_items_metum": "BazaarItemsMeta",
},
"packages": [
{
"path": "db",
"engine": "postgresql",
"schema": "query.sql",
"queries": "query.sql"
}
]
} https://play.sqlc.dev/p/c955263efe1a2f6b8ca8e1d040032caeccb181aaaad184d81907d3e66e9a72c2 You can also set the emit_exact_table_names option to true, but that applies to all tables. |
Version
1.15.0
What happened?
I have a table called items_meta. When sqlc goes to make the struct the logic that attempts to make idiomatic go translates it to
type TableItemsMetum struct
. While this is usable that isn't, according to any reading I can find, an appropriate way to "singularize" that. Is sqlc applying the rules for data/datum to words that end ina
?This behavior also happens with the following words:
Database schema
SQL queries
No response
Configuration
Playground URL
https://play.sqlc.dev/p/66ae898df20d0347156df3f8bf842c3ed04709d5a9da5acf3aec9a229a2941db
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: