volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

Is it possible to accept the args to specify the templates path #270

Closed namco1992 closed 6 years ago

namco1992 commented 6 years ago

Hi, The sqlboiler generates the models' code from the template files which are contained in the git repo, which makes customization more difficult since we need to clone and maintain our own repo if we just want to change the templates.

For example, I only need to add deleted_at IS NULL in the select template and change all the deletes to updates in the delete template to implement the soft delete, which won't involve any new variables and quite straightforward. If we can specify the templates path in the args when we generate the code, it would be better than maintaining my own repo and keep syncing with yours or changing the generated code afterwards.

I hope you can consider it and of course I'm willing to help if it's possible or you have a better solution. Thanks.

ceshihao commented 6 years ago

https://github.com/volatiletech/sqlboiler/blob/7e0eca627f995e2476d637ada0c3b70ecb5d837c/main.go#L78

It seems that you can set basedir.

namco1992 commented 6 years ago

@ceshihao sorry I didn't check the doc carefully before, will try this arg, thank you for the help and I will close this issue.