Skip to content

consistent field naming for _id columns #3306

Closed
@bassettb

Description

@bassettb

What do you want to change?

Column names ending in "_id" are handled inconsistently when converting to Go field names. For example, app_id becomes AppID instead of AppId. It would be a breaking change to fix this for all users.

I propose creating a new config option, use_capital_id, that enables a more consistent naming scheme with no special handling for _id columns. IE, they become Go fields ending in Id .

This may seem nit-picky. But migrating a large existing application to sqlc is challenging. If the developers were consistent in naming Id columns (of which there are many), then it becomes much harder to drop in new sqlc generated objects. This change would save developers having to add a hundreds of rename rules.

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions