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 possibility to hook into modelgen plugin #897

Merged
merged 3 commits into from
Nov 11, 2019
Merged

Add possibility to hook into modelgen plugin #897

merged 3 commits into from
Nov 11, 2019

Commits on Nov 11, 2019

  1. 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 #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,
        }
    
        ...
    }
    
    ```
    mskrip committed Nov 11, 2019
    Configuration menu
    Copy the full SHA
    1f272d1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6ceb76b View commit details
    Browse the repository at this point in the history
  3. Add modelgen hook recipe

    mskrip committed Nov 11, 2019
    Configuration menu
    Copy the full SHA
    2a269dd View commit details
    Browse the repository at this point in the history