util

package
v0.0.0-...-deee4d6 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(decodeStr string, key []byte) ([]byte, error)

func AesEncrypt

func AesEncrypt(encodeStr string, key []byte) (string, error)

func Call

func Call(method, baseUrl, path string, body io.Reader, headers map[string][]string) ([]byte, int, error)

func CheckInterfaceMapInterface

func CheckInterfaceMapInterface(i interface{}) (map[string]interface{}, error)

CheckInterfaceMapInterface check whether the interface is map[string]interface{}

func CheckMapBool

func CheckMapBool(m map[string]interface{}, key string) (bool, error)

CheckMapBool check whether the map key's value type is bool

func CheckMapInt

func CheckMapInt(m map[string]interface{}, key string) (int, error)

CheckMapInt check whether the map key's value type is int

func CheckMapInt32

func CheckMapInt32(m map[string]interface{}, key string) (int32, error)

CheckMapInt32 check whether the map key's value type is int32

func CheckMapInt64

func CheckMapInt64(m map[string]interface{}, key string) (int64, error)

CheckMapInt64 check whether the map key's value type is int64

func CheckMapInterface

func CheckMapInterface(m map[string]interface{}, key string) (map[string]interface{}, error)

CheckMapInterface check whether the map key's value type is interface{}

func CheckMapInterfaceSlice

func CheckMapInterfaceSlice(m map[string]interface{}, key string) ([]interface{}, error)

CheckMapInterfaceSlice check whether the map key's value type is []interface{}

func CheckMapString

func CheckMapString(m map[string]interface{}, key string) (string, error)

CheckMapString check whether the map key's value type is string

func CheckMapUInt16

func CheckMapUInt16(m map[string]interface{}, key string) (uint16, error)

CheckMapUInt16 check whether the map key's value type is int

func CheckMapUInt32

func CheckMapUInt32(m map[string]interface{}, key string) (uint32, error)

CheckMapUInt32 check whether the map key's value type is uint32

func CheckValue

func CheckValue(v interface{}, vType string) error

func Compare

func Compare(a, b []byte) int

Compare two byte variable

func DecodeJSON

func DecodeJSON(bytes []byte) (map[string]interface{}, error)

DecodeJSON decode a bytes to Json object

func DecodeJson

func DecodeJson(data []byte) (map[string]interface{}, error)

func DecodeReader

func DecodeReader(r io.Reader) (map[string]interface{}, error)

func EncodeJSON

func EncodeJSON(data interface{}) ([]byte, error)

EncodeJSON encode object to []byte

func EncodeJson

func EncodeJson(data interface{}) ([]byte, error)

func GenerateRandomID

func GenerateRandomID() string

GenerateRandomID returns an unique id

func HandlerError

func HandlerError(resp http.ResponseWriter, data string, httpCode int, stateCode int)

func IsFileExists

func IsFileExists(filename string) bool

IsFileExists - whether the file exist @filename: file full path name

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

func ReadFile

func ReadFile(filename string) ([]byte, error)

ReadFile read the content of the file

func Request

func Request(method, baseUrl, path string, body io.Reader) ([]byte, int, error)

func Response

func Response(data []byte, statusCode int, resp http.ResponseWriter)

Types

This section is empty.

Jump to

Keyboard shortcuts

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