Documentation ¶
Index ¶
- Constants
- func CollectRequestParams(r *http.Request) (params map[string]string)
- func DefaultHandlerOption() *handlerOption
- func ExecuteRequestWithJson(method string, url string, timeout time.Duration, token string, ...) error
- func GetJson(url string, timeout time.Duration, token string, request interface{}, ...) error
- func NewHandlerOption(optionFuncs ...HandlerOptionFunc) *handlerOption
- func ParseIntRequestParam(requestParams map[string]string, requestParamName string, must bool) (requestParam int, err error)
- func ParseIntSliceRequestParam(requestParams map[string]string, requestParamName string, must bool) (requestParam []int, err error)
- func ParseString2StringMapRequestParam(requestParams map[string]string, requestParamName string, must bool) (requestParam map[string]string, err error)
- func ParseStringRequestParam(requestParams map[string]string, requestParamName string, must bool) (requestParam string, err error)
- func PostJson(url string, timeout time.Duration, token string, request interface{}, ...) error
- type ErrConvert2NumFail
- type ErrInvalidParam
- type ErrInvalidSign
- type ErrParseFormFail
- type HandlerOptionFunc
- type InternalRequest
- type InternalResponse
- type Response
- type Server
- func (s *Server) Dispatch(super mactor.ISuper, sender *actor.PID, ctx actor.Context, ...)
- func (s *Server) Listen(addr string) (err error)
- func (s *Server) Listener() net.Listener
- func (s *Server) MustRegister(super mactor.ISuper, pattern string, fn http.HandlerFunc, ...)
- func (s *Server) Serve()
- func (s *Server) ServeTLS(certFile string, keyFile string)
- type URLRequest
Constants ¶
const DefaultMinDispatchInterval = 0 * time.Millisecond
const DefaultTimeout = 60 * time.Second
const (
SignName = "sign"
)
Variables ¶
This section is empty.
Functions ¶
func CollectRequestParams ¶
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func DefaultHandlerOption ¶
func DefaultHandlerOption() *handlerOption
func ExecuteRequestWithJson ¶
func NewHandlerOption ¶
func NewHandlerOption(optionFuncs ...HandlerOptionFunc) *handlerOption
func ParseIntRequestParam ¶
func ParseIntRequestParam(requestParams map[string]string, requestParamName string, must bool) (requestParam int, err error)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func ParseStringRequestParam ¶
Types ¶
type ErrConvert2NumFail ¶
type ErrConvert2NumFail struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewErrConvert2NumFail ¶
func NewErrConvert2NumFail(str string, err error) *ErrConvert2NumFail
func (ErrConvert2NumFail) Error ¶
func (e ErrConvert2NumFail) Error() string
type ErrInvalidParam ¶
type ErrInvalidParam struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewErrInvalidParam ¶
func NewErrInvalidParam(name string, value string) *ErrInvalidParam
func (ErrInvalidParam) Error ¶
func (e ErrInvalidParam) Error() string
type ErrInvalidSign ¶
type ErrInvalidSign struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewErrInvalidSign ¶
func NewErrInvalidSign(invalidSign string, validSign string) *ErrInvalidSign
func (ErrInvalidSign) Error ¶
func (e ErrInvalidSign) Error() string
type ErrParseFormFail ¶
type ErrParseFormFail struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewParseFormFail ¶
func NewParseFormFail(err error) *ErrParseFormFail
func (ErrParseFormFail) Error ¶
func (e ErrParseFormFail) Error() string
type HandlerOptionFunc ¶
type HandlerOptionFunc func(option *handlerOption)
func WithHandlerMinDispatchInterval ¶
func WithHandlerMinDispatchInterval(minDispatchInterval time.Duration) HandlerOptionFunc
func WithHandlerTimeout ¶
func WithHandlerTimeout(timeout time.Duration) HandlerOptionFunc
type InternalRequest ¶
type InternalRequest struct { Pattern string W http.ResponseWriter R *http.Request }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type InternalResponse ¶
type InternalResponse struct { W http.ResponseWriter R *http.Request }
func InternalRequestResponse ¶
func InternalRequestResponse(pid *actor.PID, send *InternalRequest, timeout time.Duration) (*InternalResponse, error)
type Response ¶
type Response struct { Sign string `json:"sign"` ErrorCode int `json:"error_code"` ErrorMessage string `json:"error_msg"` Data string `json:"data"` }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewResponse ¶
func NewResponse() *Response
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func (*Server) MustRegister ¶
type URLRequest ¶
type URLRequest struct {
Sign string `json:"sign"`
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
func NewURLRequest ¶
func NewURLRequest() *URLRequest