Documentation ¶
Index ¶
- func Logger(inner http.Handler) http.Handler
- func Metrics(inner http.Handler) http.Handler
- func NewClient() *resty.Client
- func Rest(inner http.Handler) http.Handler
- type ChiHttpSrv
- type DdClient
- type DdClientOption
- type DefaultHttpSrv
- type HttpLog
- type IServiceProvider
- type MemberlistProviderOption
- type MemberlistServiceProvider
- type Route
- type ServiceProvider
- type ServiceProviderOption
- type Srv
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChiHttpSrv ¶
type ChiHttpSrv struct { *chi.Mux // contains filtered or unexported fields }
type DdClient ¶ added in v0.3.7
type DdClient interface { SetProvider(provider IServiceProvider) SetClient(client *resty.Client) }
type DdClientOption ¶ added in v0.3.7
type DdClientOption func(DdClient)
func WithClient ¶ added in v0.3.7
func WithClient(client *resty.Client) DdClientOption
func WithProvider ¶ added in v0.3.7
func WithProvider(provider IServiceProvider) DdClientOption
type DefaultHttpSrv ¶
gorilla
func (*DefaultHttpSrv) AddMiddleware ¶
func (srv *DefaultHttpSrv) AddMiddleware(mwf ...func(http.Handler) http.Handler)
func (*DefaultHttpSrv) AddRoute ¶
func (srv *DefaultHttpSrv) AddRoute(route ...Route)
func (*DefaultHttpSrv) Run ¶
func (srv *DefaultHttpSrv) Run()
type HttpLog ¶ added in v0.2.4
type HttpLog struct { ClientIp string `json:"clientIp,omitempty"` HttpMethod string `json:"httpMethod,omitempty"` Uri string `json:"uri,omitempty"` Proto string `json:"proto,omitempty"` Host string `json:"host,omitempty"` ReqContentLength int64 `json:"reqContentLength,omitempty"` ReqHeader http.Header `json:"reqHeader,omitempty"` RequestId string `json:"requestId,omitempty"` RawReq string `json:"rawReq,omitempty"` RespBody string `json:"respBody,omitempty"` StatusCode int `json:"statusCode,omitempty"` RespHeader http.Header `json:"respHeader,omitempty"` RespContentLength int `json:"respContentLength,omitempty"` ElapsedTime string `json:"elapsedTime,omitempty"` // in ms Elapsed int64 `json:"elapsed,omitempty"` }
POST /usersvc/pageusers HTTP/1.1 Host: localhost:6060 Content-Length: 80 Content-Type: application/json User-Agent: go-resty/2.6.0 (https://github.com/go-resty/resty) X-Request-Id: d1e4dc83-18be-493e-be5b-2e0faaca90ec
{"filter":{"dept":99,"name":"Jack"},"page":{"orders":null,"pageNo":2,"size":10}}
type IServiceProvider ¶ added in v0.2.3
func NewMemberlistServiceProvider ¶ added in v0.2.4
func NewMemberlistServiceProvider(name string, registry registry.IRegistry, opts ...MemberlistProviderOption) IServiceProvider
func NewServiceProvider ¶ added in v0.2.3
func NewServiceProvider(env string, opts ...ServiceProviderOption) IServiceProvider
type MemberlistProviderOption ¶ added in v0.2.4
type MemberlistProviderOption func(IServiceProvider)
type MemberlistServiceProvider ¶ added in v0.2.4
type MemberlistServiceProvider struct {
// contains filtered or unexported fields
}
func (*MemberlistServiceProvider) SelectServer ¶ added in v0.2.4
func (m *MemberlistServiceProvider) SelectServer() (string, error)
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
type ServiceProvider ¶ added in v0.2.3
type ServiceProvider struct {
Env string
}
func (*ServiceProvider) SelectServer ¶ added in v0.2.3
func (s *ServiceProvider) SelectServer() (string, error)
type ServiceProviderOption ¶ added in v0.2.3
type ServiceProviderOption func(IServiceProvider)
Click to show internal directories.
Click to hide internal directories.