Documentation ¶
Index ¶
- func WithValueCallOption(ctx context.Context, cs *CallSettings) context.Context
- type Address
- type Balancer
- type CallOption
- type CallSettings
- type Client
- func (c *Client) CallSetting(path string, cos ...CallOption) *CallSettings
- func (c *Client) Delete(ctx context.Context, path string, req, resp any, opts ...CallOption) error
- func (c *Client) Deref() *resty.Client
- func (c *Client) EncodeQuery(v any) (string, error)
- func (c *Client) EncodeURL(pathTemplate string, msg any, needQuery bool) string
- func (c *Client) Execute(ctx context.Context, method, path string, req, resp any, opts ...CallOption) error
- func (c *Client) Get(ctx context.Context, path string, req, resp any, opts ...CallOption) error
- func (c *Client) Head(ctx context.Context, path string, req, resp any, opts ...CallOption) error
- func (c *Client) Invoke(ctx context.Context, method, path string, in, out any, settings *CallSettings) error
- func (c *Client) Options(ctx context.Context, path string, req, resp any, opts ...CallOption) error
- func (c *Client) Patch(ctx context.Context, path string, req, resp any, opts ...CallOption) error
- func (c *Client) Post(ctx context.Context, path string, req, resp any, opts ...CallOption) error
- func (c *Client) Put(ctx context.Context, path string, req, resp any, opts ...CallOption) error
- func (c *Client) Use(mws ...Middleware) *Client
- type ClientOption
- type Handler
- type Middleware
- type Option
- func Registry(r registry.Registry) Option
- func WithCallOption(co ...CallOption) Option
- func WithEncoding(codec *wencoding.Encoding) Option
- func WithServiceAddr(addr string) Option
- func WithServiceName(name string) Option
- func WithTokenSource(t oauth2.TokenSource) Option
- func WithValidate(f func(any) error) Option
- type Peer
- type RR
- type Resolver
- type Target
- type Wrr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithValueCallOption ¶
func WithValueCallOption(ctx context.Context, cs *CallSettings) context.Context
WithValueCallOption returns a new Context that carries value.
Types ¶
type CallOption ¶
type CallOption func(cs *CallSettings)
CallOption is an option used by Invoke to control behaviors of RPC calls. CallOption works by modifying relevant fields of CallSettings.
func WithCoContentType ¶
func WithCoContentType(contentType string) CallOption
WithCoContentType use encoding.MIMExxx
type CallSettings ¶
type CallSettings struct { // Path overwrite api call Path string // contains filtered or unexported fields }
CallSettings allow fine-grained control over how calls are made.
func DefaultCallOption
deprecated
func DefaultCallOption(path string, opts ...CallOption) CallSettings
Deprecated: use Client.CallSetting(path string, opts ...CallOption) api.
func FromValueCallOption ¶
func FromValueCallOption(ctx context.Context) (cs CallSettings, ok bool)
FromValueCallOption returns the CallSettings value stored in ctx, if any.
func MustFromValueCallOption ¶
func MustFromValueCallOption(ctx context.Context) *CallSettings
MustFromValueCallOption returns the CallSettings value stored in ctx.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CallSetting ¶
func (c *Client) CallSetting(path string, cos ...CallOption) *CallSettings
func (*Client) Delete ¶
Delete method does DELETE HTTP request. It's defined in section 4.3.5 of RFC7231.
func (*Client) EncodeQuery ¶
EncodeQuery encode v into “URL encoded” form ("bar=baz&foo=quux") sorted by key.
func (*Client) EncodeURL ¶
EncodeURL encode msg to url path. pathTemplate is a template of url path like http://helloworld.dev/{name}/sub/{sub.name}.
func (*Client) Invoke ¶
func (c *Client) Invoke(ctx context.Context, method, path string, in, out any, settings *CallSettings) error
Invoke the request NOTE: Do not use this function. use Execute instead.
func (*Client) Options ¶
Options method does OPTIONS HTTP request. It's defined in section 4.3.7 of RFC7231.
func (*Client) Use ¶
func (c *Client) Use(mws ...Middleware) *Client
type ClientOption ¶
type ClientOption func(*Client)
type Middleware ¶
func Chain ¶
func Chain(m ...Middleware) Middleware
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithCallOption ¶
func WithCallOption(co ...CallOption) Option
WithCallOption WithCallOption(WithCoNoAuth)
func WithEncoding ¶
func WithServiceAddr ¶
func WithServiceName ¶
func WithTokenSource ¶
func WithTokenSource(t oauth2.TokenSource) Option