Skip to content
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

JSON tag naming style can be configurable #234

Closed
waltcow opened this issue Nov 18, 2021 · 1 comment · Fixed by #239
Closed

JSON tag naming style can be configurable #234

waltcow opened this issue Nov 18, 2021 · 1 comment · Fixed by #239
Assignees

Comments

@waltcow
Copy link

waltcow commented Nov 18, 2021

Describe the feature

JSON tag naming style can be configurable,

various options like (e.g. snake case or camel case), by default use columnName

@tr1v3r
Copy link
Member

tr1v3r commented Nov 21, 2021

There are two way to diy json tag name strategy,

global:

g.WithJSONTagNameStrategy(func(col string) (tag string) { return col + "_" })

scope:

g.ApplyBasic(g.GenerateModel("table", gen.FieldJSONTagWithNS(func(col string) (tag string) { return col+"_" })))

tr1v3r added a commit that referenced this issue Nov 22, 2021
* feat(generate): allow user specify tag name stragety
close #234

* style(generate): name return value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants