Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 726 Bytes

README_HOOKS.md

File metadata and controls

25 lines (20 loc) · 726 Bytes

Hooks

Go Reference

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),
)