package
0.1.15
Repository: https://github.com/flyingon/go-common.git
Documentation: pkg.go.dev

# Functions

AESCBCDecrypt aes解密 cbc blockSize:16.
AESECBDecrypt decrypt aes解密 ecb blockSize:16.
AESECBEncrypt encrypt aes加密 ecb blockSize:16.
BatchGetValues 遍历获取[]*Struct,[]Struct,[]map[string]interface 中指定字段.
BytesToStringFast convert bytes to string quickly by avoiding underlying (indirect part) memory allocation.
No description provided by the author
Check whether file is existed, if existed returns true, otherwise returns false.
CheckKeyExist 检查keys中的key是否都存在于data中.
CreateDir create dir if it doesn't exist, return error if `dir` existed while it is not a directory, return error if any other error occurs.
DeepCopy deeply copy v.
No description provided by the author
No description provided by the author
Find return the index of string `x` in []string `a`.
transform GBK bytes to UTF-8 bytes.
生成count个[start,end)结束的不重复的随机数.
将interface{} 转换成 []byte, 支持string, float64和[]byte.
Get current directory of executable file, if fails returns empty filepath and error.
GetDeltaWeekZeroTs 获取n周前0点时间戳.
GetLocalIP 获取当前服务器IP.
GetMd5V1 获取字符串md5.
GetMd5V2 获取字符串md5.
GetMd5V3 获取字符串md5.
Get parental directory of executable file, if fails returns empty filepath and error.
GetPosByteNum 获取指定位置全为0或者为1的数字 in: 1 out: 1 11111111111111111110 in: 5 out: 10000 11111111111111101111.
生成指定位数的随机字符串.
GetZeroValueByType 获得指定类型到0值.
GoAndWait 封装更安全的多并发调用, 启动goroutine并等待所有处理流程完成,自动recover 返回值error返回的是多并发协程里面第一个返回的不为nil的error,主要用于关键路径判断,当多并发协程里面有一个是关键路径且有失败则返回err,其他非关键路径并发全部返回nil.
InterfaceCopy 结构体拷贝-注意: 传入结构体对象, 传指针只能复制地址,没有意义.
No description provided by the author
InterfaceToFloat64 ...
InterfaceToInt 将interface{} 转换成 int 强制转换,忽略精度丢失; 忽略忽略错误,错误返回0.
InterfaceToInt64 将interface{} 转换成 int64 强制转换,忽略精度丢失; 忽略忽略错误,错误返回0.
InterfaceToString 将interface{} 转换成 string.
No description provided by the author
InterfaceToUint64 将interface{} 转换成 uint64 强制转换,忽略精度丢失; 忽略忽略错误,错误返回0.
IntsToString [1,2,3] => "1,2,3".
IntsToStrings [1,2,3] => ["1","2","3"].
No description provided by the author
IsEmptyValue 零值判断.
IsEmptyValueV2 零值判断 入参: reflect.Value.
IsStrInList 判断字符串e是否在字符串数组l中.
JSONMarshal json序列化,escape设置为false.
JSONMarshal json序列化,escape设置为false.
JSONUnMarshal 设置UseNumber,防止uint64位精度缺失.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
铺平嵌套map 例如: { "k1":{ "k2":v } } 铺平后为 { "k1.k2":v } */.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ParamsCheck 参数检查.
No description provided by the author
判断文件夹是否存在.
ReadLines 读文件.
ReportMonitor 上报监控 args: 0: 上报累计的数值,默认是1.
ReportTimeDuration 耗时上报 TODO: 自定义实现.
RoundDown 浮点类型保留小数点后n位精度,舍弃后面的.
RoundFloat64 浮点类型保留小数点后n位精度.
RoundNormal 浮点类型保留小数点后n位精度, 四舍五入.
RoundUp 浮点类型保留小数点后n位精度,向上进位.
SetReqDefault 设置proto请求里面的默认值.
Setw 用c补充s长度到l, 类似C++: std::setw(16) << std::setfill('0').
No description provided by the author
SortedAppend 顺序插入.
No description provided by the author
SortedRem 顺序.
按分定时.
按月定时.
按秒定时 每次不重新生成timer.
StringToBytesFast convert string to []byte quickly by avoiding underlying (indirect part) memory allocation.
StringToInts "1,2,3" => [1,2,3].
No description provided by the author
No description provided by the author
SubStrDecodeRuneInString 基于UTF8编码截取字段.
No description provided by the author
TranStringToType 转换string类型到指定类型.
顺序执行,遇到err退出 并发执行使用.
transform UTF-8 bytes to GBK bytes.
ValueToStr JSONUnMarshal到map[string]interface{}后interface{} to string.
No description provided by the author

# Variables

No description provided by the author

# Structs

ParamCheck 单个参数检查结构体.

# Interfaces

Copier is used to make a deepcopy if receiver implements it.
CopierTo is used to make a shallow copy if receiver implements it.