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

How do I attach afterSave hook? #9

Closed
genxstylez opened this issue Mar 31, 2016 · 1 comment
Closed

How do I attach afterSave hook? #9

genxstylez opened this issue Mar 31, 2016 · 1 comment

Comments

@genxstylez
Copy link

Can you give me a simple example?

Thanks

@yaronius
Copy link

yaronius commented Mar 27, 2017

Strange that nobody has answered this question yet. Your document must comply with the AfterSaveHook interface (declared in collection.go). It means that you should only add AfterSave(*Collection) method, something like this:

type Person struct {
        // ... same as in example
}

func (doc *Person) AfterSave(c *bongo.Collection) error {
        // do something
        return nil
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants