Fix hook documentation to include error return

Fix #171
This commit is contained in:
Aaron L 2017-07-02 11:16:21 -07:00 committed by Alex Grintsvayg
parent ca9f47de8b
commit ce9d13abf0

View file

@ -956,15 +956,16 @@ it with the `AddModelHook` method. Here is an example of a before insert hook:
```go ```go
// Define my hook function // Define my hook function
func myHook(exec boil.Executor, p *Pilot) { func myHook(exec boil.Executor, p *Pilot) error {
// Do stuff // Do stuff
return nil
} }
// Register my before insert hook for pilots // Register my before insert hook for pilots
models.AddPilotHook(boil.BeforeInsertHook, myHook) models.AddPilotHook(boil.BeforeInsertHook, myHook)
``` ```
Your `ModelHook` will always be defined as `func(boil.Executor, *Model)` Your `ModelHook` will always be defined as `func(boil.Executor, *Model) error`
### Transactions ### Transactions