utils

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(n int) []byte

Bytes generates n random bytes

func GenerateSha256

func GenerateSha256(key, data string) string

GenerateSha256 generate sha256

func GetCurrTime

func GetCurrTime() int

GetCurrTime get expire timestamp

func GetDateNum

func GetDateNum() string

GetDateNum get date num

func GetMD5String

func GetMD5String(strings string) string

GetMD5String md5 string

func HTTPQueryBuild

func HTTPQueryBuild(params map[string]string) string

HTTPQueryBuild http_query_build

func Hex

func Hex(n int) string

Hex ...

func Md5ByByte

func Md5ByByte(bytes []byte) string

Md5ByByte md5 by byte

func QuerySortByKeyStr

func QuerySortByKeyStr(m map[string]string) (str string)

QuerySortByKeyStr sign (using buffer could be better than string)

func QuerySortByKeyStr2

func QuerySortByKeyStr2(params map[string]string) (str string)

QuerySortByKeyStr2 query sort by key str2

func RandNum added in v1.1.0

func RandNum(min, max int) int

RandNum rand num

func SortByKey

func SortByKey(m map[string]string) (str []string)

SortByKey sort by key

Types

type HTTPClient

type HTTPClient struct {
	Client   *http.Client
	Response *http.Response
}

HTTPClient http's client

func (*HTTPClient) GetResponseByte

func (c *HTTPClient) GetResponseByte() (body []byte, err error)

GetResponseByte get response byte

func (*HTTPClient) GetResponseJSON

func (c *HTTPClient) GetResponseJSON(response interface{}) error

GetResponseJSON get response json

func (*HTTPClient) HTTPGet

func (c *HTTPClient) HTTPGet(url string, params map[string]string) error

HTTPGet get method

func (*HTTPClient) HTTPPost

func (c *HTTPClient) HTTPPost(url string, params map[string]string) error

HTTPPost post string

func (*HTTPClient) HTTPPostJSON

func (c *HTTPClient) HTTPPostJSON(url, jsonStr string) error

HTTPPostJSON post json

Jump to

Keyboard shortcuts

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