Documentation ¶
Index ¶
- Constants
- Variables
- func AesDecrypt(src, key []byte) (dst []byte, err error)
- func AesEncrypt(src []byte, key []byte) ([]byte, error)
- func ConvertToString(v interface{}) (str string)
- func GetBody(uri string) ([]byte, error)
- func GetFile(filename, uri string) error
- func GetJson(uri string, v interface{}) error
- func GetRandomString(l int) string
- func GetXml(uri string, v interface{}) error
- func Min(first int, args ...int) int
- func PKCS7Pad(msg []byte, blockSize int) []byte
- func PKCS7UnPad(msg []byte) []byte
- func PostFile(fieldname, filename, uri string) ([]byte, error)
- func PostJson(uri string, obj interface{}) ([]byte, error)
- func PostJsonPtr(uri string, obj interface{}, result interface{}, contentType ...string) (err error)
- func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)
- func PostXmlPtr(uri string, obj interface{}, result interface{}) (err error)
- func SetHTTPClientFactory(f func() *http.Client)
- func SetTimeOut(d time.Duration)
- func SortMd5(s ...string) string
- func SortSha1(s ...string) string
- func Substr(str string, start int, end int) string
- type BodyMap
- func (bm BodyMap) CheckEmptyError(keys ...string) error
- func (bm BodyMap) EncodeAliPaySignParams() string
- func (bm BodyMap) EncodeGetParams() string
- func (bm BodyMap) EncodeWeChatSignParams(apiKey string) string
- func (bm BodyMap) Get(key string) string
- func (bm BodyMap) GetInterface(key string) interface{}
- func (bm BodyMap) GetString(key string) string
- func (bm BodyMap) JsonBody() (jb string)
- func (bm BodyMap) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
- func (bm BodyMap) Remove(key string)
- func (bm BodyMap) Reset()
- func (bm BodyMap) Set(key string, value interface{}) BodyMap
- func (bm BodyMap) SetBodyMap(key string, value func(bm BodyMap)) BodyMap
- func (bm BodyMap) SetFormFile(fieldName string, filePath string) (err error)
- func (bm *BodyMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
- type MultipartFormField
Constants ¶
View Source
const NULL = ""
Variables ¶
View Source
var TimeOut time.Duration = 60 * time.Second
TimeOut 全局请求超时设置,默认1分钟
Functions ¶
func AesDecrypt ¶
AesDecrypt AES-CBC解密,PKCS#7,传入密文和密钥,[]byte
func AesEncrypt ¶
AesEncrypt AES-CBC加密+PKCS#7打包,传入明文和密钥
func ConvertToString ¶
func ConvertToString(v interface{}) (str string)
func PostJsonPtr ¶
func PostJsonPtr(uri string, obj interface{}, result interface{}, contentType ...string) (err error)
PostJsonPtr 发送Json格式的POST请求并解析结果到result指针
func PostMultipartForm ¶
func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)
PostMultipartForm 上传文件或其他表单数据
func PostXmlPtr ¶
PostXmlPtr 发送Xml格式的POST请求并解析结果到result指针
func SetHTTPClientFactory ¶
Types ¶
type BodyMap ¶
type BodyMap map[string]interface{}
func (BodyMap) CheckEmptyError ¶
func (BodyMap) EncodeAliPaySignParams ¶
("bar=baz&foo=quux") sorted by key.
func (BodyMap) EncodeWeChatSignParams ¶
("bar=baz&foo=quux") sorted by key.
func (BodyMap) MarshalXML ¶
func (BodyMap) SetBodyMap ¶
func (BodyMap) SetFormFile ¶
设置 FormFile
func (*BodyMap) UnmarshalXML ¶
Click to show internal directories.
Click to hide internal directories.