Versions in this module Expand all Collapse all v0 v0.6.0 Sep 15, 2026 v0.5.1 Sep 14, 2026 v0.5.0 Sep 14, 2026 v0.4.0 Sep 10, 2026 v0.3.1 Sep 9, 2026 v0.3.0 Sep 9, 2026 v0.2.3 Sep 9, 2026 v0.2.2 Sep 9, 2026 v0.2.1 Sep 9, 2026 v0.2.0 Sep 9, 2026 v0.1.0 Sep 9, 2026 Changes in this version + const ClientDirective + const DefaultAttempts + const DefaultBackoff + const DefaultCooldown + const DefaultThreshold + const DefaultTimeout + const GeneratedFile + const MaxBackoff + const MaxErrorBody + const MethodPrefix + const TracerName + var ErrBreakerOpen = errors.New("client: the circuit breaker is open") + func Bool(v bool) string + func Check(dir string) error + func Escape(v string) string + func Float(v float64) string + func Generate(dir string) ([]string, error) + func Int(v int64) string + func MustDuration(v string) time.Duration + func NewHeader() http.Header + func NewQuery() url.Values + func Uint(v uint64) string + type Auth string + const AuthBasic + const AuthBearer + const AuthNone + type Breaker struct + func NewBreaker(cfg BreakerConfig) *Breaker + func (b *Breaker) Allow() error + func (b *Breaker) Failure() + func (b *Breaker) State() State + func (b *Breaker) Success() + type BreakerConfig struct + Cooldown time.Duration + Now func() time.Time + Threshold int + type Client struct + func New(name string, opts ...Option) (*Client, error) + func (c *Client) Do(ctx context.Context, req Request, out any) error + type Doer interface + Do func(req *http.Request) (*http.Response, error) + type Fault struct + Message string + Repair string + func (f *Fault) Error() string + type GenFault struct + Column int + File string + Line int + Message string + Repair string + func (f *GenFault) Error() string + type GenFaults struct + Faults []*GenFault + func (l *GenFaults) Error() string + func (l *GenFaults) Unwrap() []error + type Option func(*Client) + func WithAttempts(n int) Option + func WithAuth(a Auth) Option + func WithBackoff(d time.Duration) Option + func WithBaseURL(raw string) Option + func WithBasicAuth(user, password string) Option + func WithBreaker(b *Breaker) Option + func WithHTTPClient(d Doer) Option + func WithHeader(name, value string) Option + func WithTimeout(d time.Duration) Option + func WithToken(token string) Option + func WithTracer(t trace.Tracer) Option + type Request struct + Body any + Header http.Header + Idempotent bool + Method string + Op string + Path string + Query url.Values + type StaleFault struct + Path string + Reason string + func (f *StaleFault) Error() string + type State string + const StateClosed + const StateHalfOpen + const StateOpen + type StatusError struct + Body []byte + Method string + Op string + Response *http.Response + Status int + URL string + func (e *StatusError) Error() string + func (e *StatusError) RetryAfter() time.Duration + type TransportError struct + Err error + Op string + URL string + func (e *TransportError) Error() string + func (e *TransportError) Unwrap() error