utils

package
v0.0.0-...-eba14fa Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EpochTime

func EpochTime() string

Get a epoch time

eg: 1521221737

func GzipDecode

func GzipDecode(in []byte) ([]byte, error)

解压缩消息

func HmacSha256Base64Signer

func HmacSha256Base64Signer(message string, secretKey string) (string, error)

signing a message using: hmac sha256 + base64

eg:
  message = Pre_hash function comment
  secretKey = E65791902180E9EF4510DB6A77F6EBAE

return signed string = TO6uwdqz+31SIPkd4I+9NiZGmVH74dXi+Fd5X0EzzSQ=

func IsoTime

func IsoTime() string

Get a iso time

eg: 2018-03-16T18:02:48.284Z

func PreHashString

func PreHashString(timestamp string, method string, requestPath string, body string) string

the pre hash string

eg:
  timestamp = 2018-03-08T10:59:25.789Z
  method  = POST
  request_path = /orders?before=2&limit=30
  body = {"product_id":"BTC-USD-0309","order_id":"377454671037440"}

return pre hash string = 2018-03-08T10:59:25.789ZPOST/orders?before=2&limit=30{"product_id":"BTC-USD-0309","order_id":"377454671037440"}

func Struct2JsonString

func Struct2JsonString(raw interface{}) (jsonString string, err error)

struct convert json string

Types

This section is empty.

Jump to

Keyboard shortcuts

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