Skip to content

json_tags camel should be camelGo #1585

Closed
@gnuletik

Description

@gnuletik

Version

Other

What happened?

Following this PR, it is now possible to configure json_tags case style with the following config:

  "emit_json_tags": true,
  "json_tags_case_style": "camel"

However, the camel option will generate JSON field itemID for an SQL column item_id.
To match camel case, it should be itemId.
I think that we should keep the current behavior under another name, like camelGo or camelInitialism.

However, this may introduce a breaking change for existing projects, so it may be wiser to add a new value for json_tags_case_style like camelJson.

The issue seems to be here :

https://github.com/kyleconroy/sqlc/blob/aade08708ea0c4aa88fe7b5dbe929e325c323ccd/internal/codegen/golang/field.go#L57-L79

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

https://play.sqlc.dev/p/e8395fd011f50b964b6356488bea183153ceb76ab74c140841dcd3563a517cc2

What operating system are you using?

No response

What database engines are you using?

No response

What type of code are you generating?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions