dbw provides two options for write operations which give callers hooks before and after the write operations:
beforeFn := func(_ interface{}) error {
return nil // always succeed for this example
}
afterFn := func(_ interface{}, _ int) error {
return nil // always succeed for this example
}
rw.Create(ctx,
&user,
dbw.WithBeforeWrite(beforeFn),
dbw.WithAfterWrite(afterFn),
)