fraenky8 / tables-to-go

convert your database tables to structs easily
MIT License
233 stars 42 forks source link

Add new option for out file name casing #30

Closed leejh3224 closed 4 years ago

leejh3224 commented 4 years ago

added file name casing as fnc for camelCase(default) and snake_case

As I wanted to have my out file name to be snake_case and it seems like there was no such option, I added this feature and added a test case for this as well.

for those of you wanting to use this option before the merge, visit forked repository

leejh3224 commented 4 years ago

I also had a hard time adding json tags for each generated model and found really nice go program called gomodifytags.

If you don't mind, can I add a link to the gist for below?

  1. generate models based on tables-to-go
  2. add json tags for each model definitions

link to gist

Maybe it would help people visiting this repository to get things done quickly.

leejh3224 commented 4 years ago

I edited the code following your comments but I may miss somethings. Thanks for guiding me in the right direction, @fraenky8

leejh3224 commented 4 years ago

Here's the link to gomodifytags and example usage: gomodifytags -file fileName -struct structName -add-tags json -w --skip-unexported

Also added an example usage in README.