Versions in this module Expand all Collapse all v2 v2.0.2 Sep 4, 2026 v2.0.1 Sep 4, 2026 Changes in this version + const CONTENT_TYPE_FILE + const CONTENT_TYPE_FORM + const CONTENT_TYPE_JSON + const CONTENT_TYPE_RESTFUL + var ErrAllInstancesCircuitOpen = errors.New("client: all instances circuit-open") + var ErrCallTimeout = errors.New("client: 微服务调用超时") + var ErrCircuitOpen = errors.New("client: 熔断器已打开,请求被快速失败") + func Call(service, uri string, op *Options) (string, error) + func CallCtx(ctx context.Context, service, uri string, op *Options) (string, error) + func CallCtxT[T any](ctx context.Context, service, uri string, op *Options) models.Result[T] + func CallResilient(service, uri string, op *Options, ro *ResilienceOptions) (string, error) + func CallResilientCtx(ctx context.Context, service, uri string, op *Options, ro *ResilienceOptions) (string, error) + func CallT[T any](service, uri string, op *Options) models.Result[T] + func ResetBreakers() + type CircuitBreaker struct + func GetBreaker(name string) *CircuitBreaker + func NewCircuitBreaker(name string, maxFailures int, interval, timeout time.Duration) *CircuitBreaker + func (cb *CircuitBreaker) Allow() bool + func (cb *CircuitBreaker) Counts() (failures int, successes int) + func (cb *CircuitBreaker) Failure() + func (cb *CircuitBreaker) Name() string + func (cb *CircuitBreaker) Reset() + func (cb *CircuitBreaker) State() State + func (cb *CircuitBreaker) String() string + func (cb *CircuitBreaker) Success() + type Options struct + Data any + Files []grequests.FileUpload + Group string + Header any + Json any + LoadBalancer string + Method string + Path map[string]string + Protocol string + Query any + Retry bool + type ResilienceOptions struct + BaseDelay time.Duration + Breaker *CircuitBreaker + MaxDelay time.Duration + MaxRetries int + RetryOnStatus func(code int) bool + Timeout time.Duration + type State int + const StateClosed + const StateHalfOpen + const StateOpen + func (s State) String() string