util

package
v0.0.0-...-0316726 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapedPath

func EscapedPath(u string) (path string, err error)

对URL进行Encode编码

func FormatDateTime

func FormatDateTime(t time.Time) string

格式化时间,按照yyyyMMddHHmmss格式

func GenerateXml

func GenerateXml(data map[string]interface{}) string

生成请求XML的Body体

func HmacSha256

func HmacSha256(str string, key string) []byte

HMAC-SHA256

func HttpGet

func HttpGet(url string) ([]byte, error)

发送GET请求

func HttpPostJson

func HttpPostJson(url string, body interface{}) ([]byte, error)

发送POST请求(JSON)

func HttpPostXml

func HttpPostXml(url string, xmlBody string) ([]byte, error)

发送POST请求(XML)

func IsValidAuthCode

func IsValidAuthCode(authcode string) (ok bool)

是否是微信付款码,18位纯数字,以10、11、12、13、14、15开头

func MarshalJson

func MarshalJson(m interface{}) string

生成JSON字符串

func Md5

func Md5(str string) []byte

MD5

func RandomString

func RandomString(length int) string

获取随机字符串

func Sha1

func Sha1(str string) []byte

SHA1

func SignWithType

func SignWithType(signType string, origin string, apiKey string) string

根据签名类型,生成签名

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL