type
Hook
A deterministic lifecycle callback.
ctxHookContext- The current operation and transaction state.
Returns error Before commit, an error fails and rolls back the operation. AfterCommit errors report a committed failure.
Example
var auditTitle ridu.Hook = func(ctx ridu.HookContext) error {
if ctx.Document == nil {
return nil
}
log.Printf("%s changed %s", ctx.Operation, ctx.Document.ID)
return nil
}