package
0.1.1
Repository: https://github.com/gole-dev/gole.git
Documentation: pkg.go.dev

# README

util

业务工具包

# Functions

BytesToString 字节切片转字符串.
ConcatString 连接字符串 NOTE: 性能比fmt.Sprintf和+号要好.
Extract returns a private addr and port.
ExtractHostPort from address.
GenShortID 生成一个id.
GetAvatarURL user's avatar, if empty, use default avatar.
GetBytes interface 转 byte.
GetDate 获取字符串日期.
GetDefaultAvatarURL 获取默认头像.
GetHostname 获取主机名.
GetInternalIP get internal ip.
GetLocalIP 获取本地内网IP.
GetQiNiuPublicAccessURL 获取七牛资源的公有链接 无需配置bucket, 域名会自动到域名所绑定的bucket去查找.
GetRealIP get user real ip.
GetShowTime 格式化时间.
GetTodayDateInt 获取整形的日期.
IsEmpty 是否是空字符串.
IsInSlice 判断某一值是否在slice中 因为使用了反射,所以时间开销比较大,使用中根据实际情况进行选择.
IsZero 检查是否是零值.
JoinInt format int64 slice to string, eg: n1,n2,n3.
Md5 字符串转md5.
NewPagination 新建分页器.
Port return a real port.
RandomStr 随机字符串.
RegexpReplace ...
SliceShuffle shuffle a slice.
SplitInt split string into int64 slice.
StringSliceContains 字符串切片中是否包含另一个字符串 来自go源码 net/http/server.go.
StringSliceEqual 判断 string和slice 是否相等 使用了传统的遍历方式.
StringSliceReflectEqual 判断 string和slice 是否相等 因为使用了反射,所以效率较低,可以看benchmark结果.
StringToBytes convert string to byte.
StringToInt 字符串转int.
StringToInt64 字符串转int64.
StringToUint64 字符串转uint64.
TimeLayout 常用日期格式化模板.
TimeToShortString 时间转日期.
TimeToString 时间转字符串.
Uint64DeleteElemInSlice 从slice删除元素 fast version, 会改变顺序 i:slice的索引值 s: slice.
Uint64DeleteElemInSliceWithOrder 从slice删除元素 slow version, 保持原有顺序 i:slice的索引值 s: slice.
Uint64ShuffleSlice 对slice进行随机.
Uint64SliceReverse 对uint64 slice 反转.

# Structs

Pagination 分页器.