forked from arsmn/fastgql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to hook into modelgen plugin
This change introduces option to implement custom hook for model generation plugin without the need to completly copy the whole `modelgen` plugin. One very possible case is as described in 99designs#876 and with this change the solution for that can be: ```golang func mutateHook(b *ModelBuild) *ModelBuild { for _, model := range b.Models { for _, field := range model.Fields { field.Tag += ` orm_binding:"` + model.Name + `.` + field.Name + `"` } } return b } ... func main() { p := modelgen.Plugin { MutateHook: mutateHook, } ... } ```
- Loading branch information
Showing
3 changed files
with
59 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.