go-redis
go-redis copied to clipboard
support for more flexible before & after process hook
the basic hook is given as
type Hook interface {
BeforeProcess(ctx context.Context, cmd Cmder) (context.Context, error)
AfterProcess(ctx context.Context, cmd Cmder) error
BeforeProcessPipeline(ctx context.Context, cmds []Cmder) (context.Context, error)
AfterProcessPipeline(ctx context.Context, cmds []Cmder) error
}
however, the before process and after process is Indivisible in my condition for some framework reasons.
So, is it possible that goredis open the WrapProcess ability to others. like this
WrapProcess(ctx context.Context, cmd Cmder, fn func(context.Context, Cmder) error) error {
before custom action
fn(ctx,cmd)
after custom action
}