github.com/songzhibin97/gkit@v1.2.13/downgrade/hystrix.go (about) 1 package downgrade 2 3 import ( 4 "context" 5 6 "github.com/afex/hystrix-go/hystrix" 7 ) 8 9 type Hystrix struct{} 10 11 func (h *Hystrix) Do(name string, run RunFunc, fallback FallbackFunc) error { 12 return hystrix.Do(name, run, fallback) 13 } 14 15 func (h *Hystrix) DoC(ctx context.Context, name string, run RunFuncC, fallback FallbackFuncC) error { 16 return hystrix.DoC(ctx, name, run, fallback) 17 } 18 19 func (h *Hystrix) Go(name string, run RunFunc, fallback FallbackFunc) chan error { 20 return hystrix.Go(name, run, fallback) 21 } 22 23 func (h *Hystrix) GoC(ctx context.Context, name string, run RunFuncC, fallback FallbackFuncC) chan error { 24 return hystrix.GoC(ctx, name, run, fallback) 25 } 26 27 func (h *Hystrix) ConfigureCommand(name string, config hystrix.CommandConfig) { 28 hystrix.ConfigureCommand(name, config) 29 } 30 31 // NewFuse 实例化方法 32 func NewFuse() Fuse { 33 return &Hystrix{} 34 }