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

Add option to support custom formats #59

Closed
eduhenke opened this issue May 7, 2020 · 1 comment
Closed

Add option to support custom formats #59

eduhenke opened this issue May 7, 2020 · 1 comment

Comments

@eduhenke
Copy link

eduhenke commented May 7, 2020

I would like to be able to customize the format of the outputted tag, like so:
Input:

type Foo struct {
  FooID int
}

What I want:

type Foo struct {
  FooID int `json:"fooId"`
}

If I use the camelcase option, the FooID, becomes, as expected, fooID, would there be any way to convert it to fooId?

@fatih
Copy link
Owner

fatih commented May 10, 2020

Unfortunately there is no such transform. These are the current transformations we use:

Screenshot-2020-05-10-00 04 29@2x

I'm not sure how to fix your case without adding significant changes to the transform part. Making it customizable is also a lot of work as it would require me to implement something that needs to be generic and embeddable into Go. I think the best way for you is to use camelcase and then do a simple sed or find/replace with an editor to change them.

Let me know if that helps you. Thanks again for your feedback.

@fatih fatih closed this as completed May 10, 2020
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

No branches or pull requests

2 participants