CommonUtil

package
v0.0.0-...-3774c73 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 可自定义盐值
	TokenSalt = "DsideaL4r5t6y7u"
)

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(cryted string, key string) string

func AesEncrypt

func AesEncrypt(orig string, key string) string

func BytesToInt

func BytesToInt(b []byte, isSymbol bool) (int, error)

isSymbol表示有无符号

func BytesToIntS

func BytesToIntS(b []byte) (int, error)

字节数(大端)组转成int(有符号)

func Capitalize

func Capitalize(str string) string

Capitalize 字符首字母大写

func ConvertMapInterfaceToMapByField

func ConvertMapInterfaceToMapByField(list []map[string]interface{}, key string, value string) map[string]string

* 功能:将数据库返回的查询结果映射成字典,用于扩展字段 作者:黄海 时间:2020-02-14

func DeleteExtraSpace

func DeleteExtraSpace(s string) string

* 功能:删除字符串多余的空格 作者:黄海 时间:2020-01-20

func ExtendList

func ExtendList(list *[]map[string]interface{}, _map map[string]string, key string, value string)

* 功能:扩展数据库查询结果集 作者:黄海 时间:2020-02-14

func GetArrayByMap

func GetArrayByMap(_dict map[string]interface{}) []string

* 功能:通过字典获取字符串数组 作者:黄海 时间:2020-02-14

func GetSnakeCaseStr

func GetSnakeCaseStr(str string) string

* 功能:获取蛇形命名的字符串 作者:黄海 时间:2020-01-22

func GetUUID

func GetUUID() string

* 功能:获取UUID 作者:黄海 时间:2020-02-03

func IntToBytes

func IntToBytes(n int, b byte) ([]byte, error)

整形转换成字节

func MD5

func MD5(data []byte) string

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blocksize int) []byte

补码

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

去码

func PutSelectResultToMapByField

func PutSelectResultToMapByField(list []map[string]interface{}, field string) map[string]interface{}

* 功能:将一个数据库查询返回结果中的某一列,形成字典 作者:黄海 时间:2020-02-14

func SelectIdsFromMapInterface

func SelectIdsFromMapInterface(list []map[string]interface{}, key string) []string

* 功能:从一个数据库的查询返回结果中获取指定字段的IDS 作者:黄海 时间:2020-02-14

Types

This section is empty.

Jump to

Keyboard shortcuts

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