util

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: Apache-2.0 Imports: 22 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aes128ECBDecode

func Aes128ECBDecode(data, key []byte) []byte

AES 128 ECB decode

func Base64Decode

func Base64Decode(data string) ([]byte, error)

func Base64Encode

func Base64Encode(data []byte) string

func Date

func Date(format string, timestamp int64) string

func ErrorNew

func ErrorNew(msg string) error

func ErrorWrap

func ErrorWrap(err error, msg string) error

func FileGetContents

func FileGetContents(fileName string) (string, error)

func FilePutContents

func FilePutContents(fileName string, content string) (int, error)

func GetISO8601TimeStamp

func GetISO8601TimeStamp() string

func GetNowDatetime

func GetNowDatetime() string

func ParsePrivateFromFile

func ParsePrivateFromFile(file string) (private *rsa.PrivateKey, err error)

根据文件名解析出私钥 ,文件必须是 rsa 私钥格式

func RawUrlencode

func RawUrlencode(str string) string

func RsaPrivateDecode

func RsaPrivateDecode(cipherText []byte, file string) ([]byte, error)

RSA 解密

func RsaPrivateSha256Encode

func RsaPrivateSha256Encode(data string, PrivateKey *rsa.PrivateKey) (signer []byte, err error)

ras sha256 私钥加密

func Rtrim

func Rtrim(str string, characterMask ...string) string

func Sha256Encode

func Sha256Encode(string string) string

sha256 签名

func StrInArray

func StrInArray(search string, strArr []string) bool

func Strrchr

func Strrchr(haystack string, needle string) string

func Strrpos

func Strrpos(haystack, needle string, offset int) int

func Strtolower

func Strtolower(str string) string

func Strtr

func Strtr(haystack string, params ...interface{}) string

func Substr

func Substr(str string, start uint, length int) string

func Time

func Time() int64

func Uniqid

func Uniqid(prefix string) string

func Urlencode

func Urlencode(str string) string

func Uuid

func Uuid() string

func YeepayBase64Decode

func YeepayBase64Decode(data string) ([]byte, error)

func YeepayBase64Encode

func YeepayBase64Encode(data []byte, usePadding bool) string

func YeepayCallback

func YeepayCallback(response string, yeepayConfig yeepayGo.YeepayConfig) (string, string, error)

func YeepayEncrypt

func YeepayEncrypt(str string, pKeyFile string) string

func YeepayGetHeader

func YeepayGetHeader(arr map[string]string) string

func YeepayGetHeaders

func YeepayGetHeaders(req request.YeepayRequest, yeepayConfig yeepayGo.YeepayConfig, yeepayLogger yeepayGo.YeepayLoggerInterface) map[string]string

func YeepayGetSignedHeader

func YeepayGetSignedHeader() string

func YeepayGetSortQuery

func YeepayGetSortQuery(arr map[string]string) string

Types

type HttpResponse

type HttpResponse struct {
	// contains filtered or unexported fields
}

func Post

func Post(url string, queryBody map[string]string, params map[string]string, headers map[string]string, logger yeepayGo.YeepayLoggerInterface) (HttpResponse, error)

func (HttpResponse) GetBytes

func (resp HttpResponse) GetBytes() []byte

func (HttpResponse) GetCode

func (resp HttpResponse) GetCode() int

func (HttpResponse) GetLatency

func (resp HttpResponse) GetLatency() float64

func (HttpResponse) GetLatencyStr

func (resp HttpResponse) GetLatencyStr() string

func (HttpResponse) IsOk

func (resp HttpResponse) IsOk() bool

func (*HttpResponse) SetBytes

func (resp *HttpResponse) SetBytes(bytes []byte) *HttpResponse

func (*HttpResponse) SetCode

func (resp *HttpResponse) SetCode(code int) *HttpResponse

func (*HttpResponse) SetStartTime

func (resp *HttpResponse) SetStartTime(startTime time.Time) *HttpResponse

Jump to

Keyboard shortcuts

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