mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
doc/hooks: add example for post mutation action (#2161)
* update hooks documentation to a post hook example * Update doc/md/hooks.md Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
This commit is contained in:
@@ -184,7 +184,10 @@ func (Card) Hooks() []ent.Hook {
|
|||||||
if s, ok := m.(interface{ SetName(string) }); ok {
|
if s, ok := m.(interface{ SetName(string) }); ok {
|
||||||
s.SetName("Boring")
|
s.SetName("Boring")
|
||||||
}
|
}
|
||||||
return next.Mutate(ctx, m)
|
v, err := next.Mutate(ctx, m)
|
||||||
|
// Post mutation action.
|
||||||
|
fmt.Println("new value:", v)
|
||||||
|
return v, err
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user