Documentation ¶
Index ¶
- Variables
- func DefaultDecoder(data []byte, dataFormat string, out *Params) (err error)
- func MD5(s string) (string, error)
- func PKCS12ToPem(p12 []byte, password string) tls.Certificate
- func RandomString(n int) string
- func Sha1(s string) (string, error)
- func Sha256Hmac(s string, k []byte) (string, error)
- func Sha256RSA(origData string, key *rsa.PrivateKey) (string, error)
- func ToGBK(src []byte) io.Reader
- func ToGBKData(src []byte) []byte
- func ToUTF8(src []byte) io.Reader
- func ToUTF8Data(src []byte) ([]byte, error)
- type Client
- type ClientBase
- type DefaultExecutor
- func (e *DefaultExecutor) Execute(verifySign ...bool) (res Results)
- func (e *DefaultExecutor) ResultValidator(...) Executor
- func (e *DefaultExecutor) Set(filed string, value interface{}) Executor
- func (e *DefaultExecutor) SetNotifyURL(url string, filedName ...string) Executor
- func (e *DefaultExecutor) UseTwowayAuthentication(b bool) Executor
- func (e *DefaultExecutor) UseXML(b bool) Executor
- type DefaultResults
- func (r *DefaultResults) Body() []byte
- func (r *DefaultResults) Code() string
- func (r *DefaultResults) Error() error
- func (r *DefaultResults) Get(key string) utils.Converter
- func (r *DefaultResults) Message() string
- func (r *DefaultResults) SubCode() string
- func (r *DefaultResults) SubMessage() string
- func (r *DefaultResults) Success() bool
- func (r *DefaultResults) Values() Params
- type Executor
- type HttpClient
- type JsonTime
- type Pairs
- type Params
- type Results
- type Time
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotExecuteYet = errors.New("not execute yet.")
)
Functions ¶
func PKCS12ToPem ¶ added in v0.1.14
func PKCS12ToPem(p12 []byte, password string) tls.Certificate
将Pkcs12转成Pem
func RandomString ¶
func ToUTF8Data ¶
Types ¶
type ClientBase ¶ added in v0.1.14
type ClientBase struct { GetHttpClient func(twowayAuthentication bool) (*http.Client, error) // contains filtered or unexported fields }
func (*ClientBase) HttpClient ¶ added in v0.1.14
func (c *ClientBase) HttpClient(twowayAuthentication bool) (*http.Client, error)
type DefaultExecutor ¶
type DefaultExecutor struct { Params Client Client BuildRequest func(*DefaultExecutor) (req *http.Request, err error) Decoder func(data []byte, dataFormat string, out *Params) (err error) TLS bool DataFormat string Err error APIURL string HTTPMethod string // contains filtered or unexported fields }
func (*DefaultExecutor) Execute ¶
func (e *DefaultExecutor) Execute(verifySign ...bool) (res Results)
func (*DefaultExecutor) ResultValidator ¶
func (*DefaultExecutor) Set ¶
func (e *DefaultExecutor) Set(filed string, value interface{}) Executor
func (*DefaultExecutor) SetNotifyURL ¶
func (e *DefaultExecutor) SetNotifyURL(url string, filedName ...string) Executor
SetNotifyURL 设置接口服务器主动通知调用服务器里指定的页面http/https路径。
func (*DefaultExecutor) UseTwowayAuthentication ¶ added in v0.1.14
func (e *DefaultExecutor) UseTwowayAuthentication(b bool) Executor
func (*DefaultExecutor) UseXML ¶
func (e *DefaultExecutor) UseXML(b bool) Executor
type DefaultResults ¶
type DefaultResults struct { Params Err error Data []byte `json:"-"` ResultCode string ResultMsg string ResultSubCode string ResultSubMsg string ResultSuccess bool }
func (*DefaultResults) Body ¶
func (r *DefaultResults) Body() []byte
func (*DefaultResults) Code ¶
func (r *DefaultResults) Code() string
func (*DefaultResults) Error ¶
func (r *DefaultResults) Error() error
func (*DefaultResults) Message ¶
func (r *DefaultResults) Message() string
func (*DefaultResults) SubCode ¶
func (r *DefaultResults) SubCode() string
func (*DefaultResults) SubMessage ¶
func (r *DefaultResults) SubMessage() string
func (*DefaultResults) Success ¶
func (r *DefaultResults) Success() bool
func (*DefaultResults) Values ¶
func (r *DefaultResults) Values() Params
type Executor ¶
type Executor interface { // Execute 执行请求并返回结果。 // verifySign 表示是否需要同步验证签名,默认 `false` 不验证。 Execute(verifySign ...bool) Results SetNotifyURL(url string, filedName ...string) Executor //设置支付宝服务器主动通知商户服务器里指定的页面http/https路径。 UseTwowayAuthentication(b bool) Executor // 是否需要双向认证 UseXML(b bool) Executor //是否使用xml作为接口数据交换格式 ResultValidator(f func(Params) (ok bool, code string, msg string, subcode string, submsg string)) Executor Set(filed string, value interface{}) Executor }
Executor 用于执行请求的相关上下文。 每个 Executor 都可以被多次执行(注意:接口业务是否允许)。
type HttpClient ¶ added in v0.1.14
type JsonTime ¶
func (JsonTime) MarshalJSON ¶
MarshalJSON 实现它的json序列化方法
Click to show internal directories.
Click to hide internal directories.