Versions in this module Expand all Collapse all v1 v1.0.1 Jul 8, 2020 Changes in this version + const ResultCodeFail + const ResultCodeSuccess + const ReturnCodeFail + const ReturnCodeSuccess + const SignType_HMAC_SHA256 + const SignType_MD5 + const SignType_SHA1 + var ErrNotFoundResultCode = errors.New("not found result_code parameter") + var ErrNotFoundReturnCode = errors.New("not found return_code parameter") + var ErrNotFoundSign = errors.New("not found sign parameter") + func APIBaseURL() string + func EditAddressSign(appId, url, timestamp, nonceStr, accessToken string) string + func FormatTime(t time.Time) string + func JsapiSign(appId, timeStamp, nonceStr, packageStr, signType string, apiKey string) string + func NativeURL1(appId, mchId, productId, timestamp, nonceStr, apiKey string) string + func NewTLSHttpClient(certFile, keyFile string) (httpClient *http.Client, err error) + func NewTLSHttpClient2(certPEMBlock, keyPEMBlock []byte) (httpClient *http.Client, err error) + func ParseTime(value string) (time.Time, error) + func Sign(params map[string]string, apiKey string, fn func() hash.Hash) string + func Sign2(params map[string]string, apiKey string, h hash.Hash) string + type BizError struct + ErrCode string + ErrCodeDesc string + ResultCode string + XMLName struct{} + func (e *BizError) Error() string + type Client struct + func NewClient(appId, mchId, apiKey string, httpClient *http.Client) *Client + func NewSubMchClient(appId, mchId, apiKey string, subAppId, subMchId string, ...) *Client + func (clt *Client) ApiKey() string + func (clt *Client) AppId() string + func (clt *Client) MchId() string + func (clt *Client) PostXML(url string, req map[string]string) (resp map[string]string, err error) + func (clt *Client) SubAppId() string + func (clt *Client) SubMchId() string + type Context struct + Msg map[string]string + Request *http.Request + RequestBody []byte + ResponseWriter http.ResponseWriter + Server *Server + func (ctx *Context) Abort() + func (ctx *Context) Get(key string) (value interface{}, exists bool) + func (ctx *Context) IsAborted() bool + func (ctx *Context) MustGet(key string) interface{} + func (ctx *Context) Next() + func (ctx *Context) Response(msg map[string]string) (err error) + func (ctx *Context) Set(key string, value interface{}) + func (ctx *Context) SetHandlers(handlers HandlerChain) + type Error struct + ReturnCode string + ReturnMsg string + XMLName struct{} + func (e *Error) Error() string + type ErrorHandler interface + ServeError func(http.ResponseWriter, *http.Request, error) + var DefaultErrorHandler ErrorHandler = ErrorHandlerFunc(defaultErrorHandlerFunc) + type ErrorHandlerFunc func(http.ResponseWriter, *http.Request, error) + func (fn ErrorHandlerFunc) ServeError(w http.ResponseWriter, r *http.Request, err error) + type Handler interface + ServeMsg func(*Context) + type HandlerChain []Handler + func (chain *HandlerChain) AppendHandler(handlers ...Handler) + func (chain *HandlerChain) AppendHandlerFunc(handlers ...func(*Context)) + func (chain HandlerChain) ServeMsg(ctx *Context) + type HandlerFunc func(*Context) + func (fn HandlerFunc) ServeMsg(ctx *Context) + type Server struct + func NewServer(appId, mchId, apiKey string, handler Handler, errorHandler ErrorHandler) *Server + func NewSubMchServer(appId, mchId, apiKey string, subAppId, subMchId string, handler Handler, ...) *Server + func (srv *Server) ApiKey() string + func (srv *Server) AppId() string + func (srv *Server) MchId() string + func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request, query url.Values) + func (srv *Server) SubAppId() string + func (srv *Server) SubMchId() string