Documentation
¶
Index ¶
- Variables
- func NewH2cClient(rwTimeout time.Duration)
- func NewHttpClient(rwTimeout time.Duration)
- func UseMiddleware(handle ...Handler)
- type Group
- type H2CRequest
- func (h2cReq *H2CRequest) Delete() Request
- func (h2cReq *H2CRequest) Get() Request
- func (h2cReq *H2CRequest) GetRequest() *http.Request
- func (h2cReq *H2CRequest) GetRespone() (*http.Response, error)
- func (h2cReq *H2CRequest) Head() Request
- func (h2cReq *H2CRequest) Next()
- func (h2cReq *H2CRequest) Post() Request
- func (h2cReq *H2CRequest) Put() Request
- func (h2cReq *H2CRequest) SetBody(byts []byte) Request
- func (h2cReq *H2CRequest) SetContext(ctx context.Context) Request
- func (h2cReq *H2CRequest) SetHeader(key, value string) Request
- func (h2cReq *H2CRequest) SetJSONBody(obj interface{}) Request
- func (h2cReq *H2CRequest) SetParam(key string, value interface{}) Request
- func (h2cReq *H2CRequest) Singleflight(key ...interface{}) Request
- func (h2cReq *H2CRequest) Stop(e ...error)
- func (h2cReq *H2CRequest) ToBytes() (value []byte, r Response)
- func (h2cReq *H2CRequest) ToJSON(obj interface{}) (r Response)
- func (h2cReq *H2CRequest) ToString() (value string, r Response)
- func (h2cReq *H2CRequest) ToXML(v interface{}) (r Response)
- func (h2cReq *H2CRequest) URI() string
- type Handler
- type HttpRequest
- func (req *HttpRequest) Delete() Request
- func (req *HttpRequest) Get() Request
- func (req *HttpRequest) GetRequest() *http.Request
- func (req *HttpRequest) GetRespone() (*http.Response, error)
- func (req *HttpRequest) Head() Request
- func (req *HttpRequest) Next()
- func (req *HttpRequest) Post() Request
- func (req *HttpRequest) Put() Request
- func (req *HttpRequest) SetBody(byts []byte) Request
- func (req *HttpRequest) SetContext(ctx context.Context) Request
- func (req *HttpRequest) SetHeader(key, value string) Request
- func (req *HttpRequest) SetJSONBody(obj interface{}) Request
- func (req *HttpRequest) SetParam(key string, value interface{}) Request
- func (req *HttpRequest) Singleflight(key ...interface{}) Request
- func (req *HttpRequest) Stop(e ...error)
- func (req *HttpRequest) ToBytes() (value []byte, r Response)
- func (req *HttpRequest) ToJSON(obj interface{}) (r Response)
- func (req *HttpRequest) ToString() (value string, r Response)
- func (req *HttpRequest) ToXML(v interface{}) (r Response)
- func (req *HttpRequest) URI() string
- type Middleware
- type Request
- type Response
- type Result
Constants ¶
This section is empty.
Variables ¶
View Source
var Marshal func(v interface{}) ([]byte, error)
View Source
var PrometheusImpl prometheus
View Source
var Unmarshal func(data []byte, v interface{}) error
Functions ¶
func UseMiddleware ¶ added in v1.6.0
func UseMiddleware(handle ...Handler)
Types ¶
type Group ¶ added in v1.5.6
type Group struct {
// contains filtered or unexported fields
}
Group represents a class of work and forms a namespace in which units of work can be executed with duplicate suppression.
func (*Group) Do ¶ added in v1.5.6
func (g *Group) Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool)
Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a duplicate comes in, the duplicate caller waits for the original to complete and receives the same results. The return value shared indicates whether v was given to multiple callers.
type H2CRequest ¶
type H2CRequest struct {
// contains filtered or unexported fields
}
H2CRequest .
func (*H2CRequest) GetRequest ¶ added in v1.6.0
func (h2cReq *H2CRequest) GetRequest() *http.Request
func (*H2CRequest) GetRespone ¶ added in v1.6.0
func (h2cReq *H2CRequest) GetRespone() (*http.Response, error)
func (*H2CRequest) Next ¶ added in v1.6.0
func (h2cReq *H2CRequest) Next()
func (*H2CRequest) SetContext ¶ added in v1.3.1
func (h2cReq *H2CRequest) SetContext(ctx context.Context) Request
SetContext .
func (*H2CRequest) SetHeader ¶
func (h2cReq *H2CRequest) SetHeader(key, value string) Request
SetHeader .
func (*H2CRequest) SetJSONBody ¶
func (h2cReq *H2CRequest) SetJSONBody(obj interface{}) Request
SetJSONBody .
func (*H2CRequest) SetParam ¶
func (h2cReq *H2CRequest) SetParam(key string, value interface{}) Request
SetParam .
func (*H2CRequest) Singleflight ¶ added in v1.5.6
func (h2cReq *H2CRequest) Singleflight(key ...interface{}) Request
func (*H2CRequest) Stop ¶ added in v1.6.0
func (h2cReq *H2CRequest) Stop(e ...error)
func (*H2CRequest) ToBytes ¶
func (h2cReq *H2CRequest) ToBytes() (value []byte, r Response)
ToBytes .
func (*H2CRequest) ToString ¶
func (h2cReq *H2CRequest) ToString() (value string, r Response)
ToString .
type Handler ¶ added in v1.6.0
type Handler func(Middleware)
type HttpRequest ¶ added in v1.5.5
type HttpRequest struct {
// contains filtered or unexported fields
}
HttpRequest .
func (*HttpRequest) GetRequest ¶ added in v1.6.0
func (req *HttpRequest) GetRequest() *http.Request
func (*HttpRequest) GetRespone ¶ added in v1.6.0
func (req *HttpRequest) GetRespone() (*http.Response, error)
func (*HttpRequest) Next ¶ added in v1.6.0
func (req *HttpRequest) Next()
func (*HttpRequest) SetBody ¶ added in v1.5.5
func (req *HttpRequest) SetBody(byts []byte) Request
SetBody .
func (*HttpRequest) SetContext ¶ added in v1.5.5
func (req *HttpRequest) SetContext(ctx context.Context) Request
SetContext .
func (*HttpRequest) SetHeader ¶ added in v1.5.5
func (req *HttpRequest) SetHeader(key, value string) Request
SetHeader .
func (*HttpRequest) SetJSONBody ¶ added in v1.5.5
func (req *HttpRequest) SetJSONBody(obj interface{}) Request
SetJSONBody .
func (*HttpRequest) SetParam ¶ added in v1.5.5
func (req *HttpRequest) SetParam(key string, value interface{}) Request
SetParam .
func (*HttpRequest) Singleflight ¶ added in v1.5.6
func (req *HttpRequest) Singleflight(key ...interface{}) Request
func (*HttpRequest) Stop ¶ added in v1.6.0
func (req *HttpRequest) Stop(e ...error)
func (*HttpRequest) ToBytes ¶ added in v1.5.5
func (req *HttpRequest) ToBytes() (value []byte, r Response)
ToBytes .
func (*HttpRequest) ToJSON ¶ added in v1.5.5
func (req *HttpRequest) ToJSON(obj interface{}) (r Response)
ToJSON .
func (*HttpRequest) ToString ¶ added in v1.5.5
func (req *HttpRequest) ToString() (value string, r Response)
ToString .
func (*HttpRequest) ToXML ¶ added in v1.5.5
func (req *HttpRequest) ToXML(v interface{}) (r Response)
ToXML .
type Middleware ¶ added in v1.6.0
type Request ¶
type Request interface {
Post() Request
Put() Request
Get() Request
Delete() Request
Head() Request
SetJSONBody(obj interface{}) Request
SetBody(byts []byte) Request
ToJSON(obj interface{}) Response
ToString() (string, Response)
ToBytes() ([]byte, Response)
ToXML(v interface{}) Response
SetHeader(key, value string) Request
SetParam(key string, value interface{}) Request
URI() string
SetContext(context.Context) Request
Singleflight(key ...interface{}) Request
}
Request .
func NewH2CRequest ¶
func NewHttpRequest ¶ added in v1.5.5
Click to show internal directories.
Click to hide internal directories.