Documentation ¶
Index ¶
- func ErrorEncode(w http.ResponseWriter, v error)
- func JSONDecode(r *http.Request, v interface{}) error
- func JSONEncode(w http.ResponseWriter, v interface{})
- func ParamFloat(r *http.Request, key string) (float64, error)
- func ParamInt(r *http.Request, key string) (int64, error)
- func ParamString(r *http.Request, key string) (string, error)
- func RawEncode(w http.ResponseWriter, v []byte)
- func RecoveryMiddleware(l log.Logger) ...
- func StreamEncode(w http.ResponseWriter, v []byte, filename string)
- func XMLDecode(r *http.Request, v interface{}) error
- func XMLEncode(w http.ResponseWriter, v interface{})
- type ClientHttp
- type ClientHttpOption
- func ClientHttpOptionAuth(s signature.Storage) ClientHttpOption
- func ClientHttpOptionCodec(enc func(in interface{}) (body []byte, contentType string, err error), ...) ClientHttpOption
- func ClientHttpOptionCodecDefault() ClientHttpOption
- func ClientHttpOptionHeaders(keyVal ...string) ClientHttpOption
- func ClientHttpOptionSetup(proxy string, ttl time.Duration, countConn int) ClientHttpOption
- type ConfigEpoll
- type ConfigHttp
- type EpollHandler
- type Router
- func (v *Router) Global(middlewares ...)
- func (v *Router) Middlewares(path string, middlewares ...)
- func (v *Router) NoFoundHandler(call func(http.ResponseWriter, *http.Request))
- func (v *Router) Route(path string, ctrl func(http.ResponseWriter, *http.Request), methods ...string)
- func (v *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type ServerDebug
- type ServerEpoll
- type ServerHttp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorEncode ¶
func ErrorEncode(w http.ResponseWriter, v error)
func JSONDecode ¶
func JSONEncode ¶
func JSONEncode(w http.ResponseWriter, v interface{})
func RawEncode ¶
func RawEncode(w http.ResponseWriter, v []byte)
func RecoveryMiddleware ¶
func RecoveryMiddleware(l log.Logger) func( func(http.ResponseWriter, *http.Request), ) func(http.ResponseWriter, *http.Request)
RecoveryMiddleware recovery go panic and write to log
func StreamEncode ¶
func StreamEncode(w http.ResponseWriter, v []byte, filename string)
func XMLEncode ¶
func XMLEncode(w http.ResponseWriter, v interface{})
Types ¶
type ClientHttp ¶
type ClientHttp struct {
// contains filtered or unexported fields
}
func NewClientHttp ¶
func NewClientHttp(opt ...ClientHttpOption) *ClientHttp
type ClientHttpOption ¶
type ClientHttpOption func(c *ClientHttp)
func ClientHttpOptionAuth ¶
func ClientHttpOptionAuth(s signature.Storage) ClientHttpOption
func ClientHttpOptionCodec ¶
func ClientHttpOptionCodecDefault ¶
func ClientHttpOptionCodecDefault() ClientHttpOption
func ClientHttpOptionHeaders ¶
func ClientHttpOptionHeaders(keyVal ...string) ClientHttpOption
func ClientHttpOptionSetup ¶
func ClientHttpOptionSetup(proxy string, ttl time.Duration, countConn int) ClientHttpOption
type ConfigEpoll ¶
type ConfigEpoll struct { Addr string `yaml:"addr"` Network string `yaml:"network,omitempty"` ReadTimeout time.Duration `yaml:"read_timeout,omitempty"` WriteTimeout time.Duration `yaml:"write_timeout,omitempty"` IdleTimeout time.Duration `yaml:"idle_timeout,omitempty"` ShutdownTimeout time.Duration `yaml:"shutdown_timeout,omitempty"` }
type ConfigHttp ¶
type ConfigHttp struct { Addr string `yaml:"addr"` Network string `yaml:"network,omitempty"` ReadTimeout time.Duration `yaml:"read_timeout,omitempty"` WriteTimeout time.Duration `yaml:"write_timeout,omitempty"` IdleTimeout time.Duration `yaml:"idle_timeout,omitempty"` ShutdownTimeout time.Duration `yaml:"shutdown_timeout,omitempty"` }
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router model
func (*Router) Global ¶
func (v *Router) Global( middlewares ...func(func(http.ResponseWriter, *http.Request), ) func(http.ResponseWriter, *http.Request))
Global add global middlewares
func (*Router) Middlewares ¶
func (v *Router) Middlewares( path string, middlewares ...func(func(http.ResponseWriter, *http.Request), ) func(http.ResponseWriter, *http.Request))
Middlewares add middlewares to route
func (*Router) NoFoundHandler ¶
func (v *Router) NoFoundHandler(call func(http.ResponseWriter, *http.Request))
NoFoundHandler ctrlHandler call if route not found
type ServerDebug ¶
type ServerDebug struct {
// contains filtered or unexported fields
}
ServerDebug service model
func NewServerDebug ¶
func NewServerDebug(c ConfigHttp, l log.Logger) *ServerDebug
NewServerDebug init debug service
type ServerEpoll ¶
type ServerEpoll struct {
// contains filtered or unexported fields
}
func NewServerEpoll ¶
func NewServerEpoll(conf ConfigEpoll, handler EpollHandler, eof []byte, l log.Logger) *ServerEpoll
type ServerHttp ¶
type ServerHttp struct {
// contains filtered or unexported fields
}
func NewServerHttp ¶
func NewServerHttp(conf ConfigHttp, handler http.Handler, l log.Logger) *ServerHttp
NewServerHttp create default http server
Source Files ¶
Click to show internal directories.
Click to hide internal directories.