Categorygithub.com/zhangjie2012/yo-kit
modulepackage
0.0.0-20221022120121-452f74e97927
Repository: https://github.com/zhangjie2012/yo-kit.git
Documentation: pkg.go.dev

# README

Go Reference Go

yo-kit

yo 脚手架基础库。

开发

测试:

go test -v -count=1 ./...

安装

go get -u github.com/zhangjie2012/yo-kit@main

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

B2i bool to int.
DayOfWeekCN 每天的星期中文描述.
DayOfWeekCN2 每天的周几中文描述.
DurationString 时间区间描述.
EndOfDay one day end time.
EndOfMonth month end datetime.
EndOfWeek week last day.
EndOfYear one year end time.
FormatDayTime 按照一天不同的时间段转换成友好的中文描述.
FormatFloat: float to string, trim tail zero https://stackoverflow.com/questions/31289409/format-a-float-to-n-decimal-places-and-no-trailing-zeros.
GenRSessionID generate a random session id, most business scene recommand.
GenSessionID generate a unique session id.
GenUUIDV1 global unique id.
GenUUIDV4 wikipedia said Randomly generated UUIDs have 122 random bits.
GenVerifyCodeAny generate verify code, get from pool.
GenVerifyCodeCommon generate verify code, letter + number.
GenVerifyCodeNumber generate verify code, all is number.
GetOutboundIP get IP address code via https://stackoverflow.com/a/37382208/802815.
HidePhonenumSensitive hide phonenum sensitive info 手机号脱敏.
I2b int t bool.
Int64SliceToString a int64 slice to string Ref: https://stackoverflow.com/questions/37532255/one-liner-to-transform-int-into-string.
IntSliceToString a int64 slice to string Ref: https://stackoverflow.com/questions/37532255/one-liner-to-transform-int-into-string.
No description provided by the author
RangeMonth get month every day date.
RangeWeek range week every day date.
RangeYear range year every day date.
SliceDifference 差集.
SliceIntersection 交集.
SliceUnion 并集.
SliceUniq 去重.
No description provided by the author
No description provided by the author
SortByKeysSF64 <string, float64> map sort by keys [via]: https://www.geeksforgeeks.org/how-to-sort-golang-map-by-keys-or-values/.
SortByValueSF64 <string, float64> map sort by values.
StartOfDay one day start time.
StartOfMonth month start datetime.
StartOfWeek week first day.
StartOfYear one year start time.
StringSplit string split by `sep` the standard library `Split` when `source` is a empty string, will return a `[""]` slice.
TraverseTimeRangeByMonth 在 start ~ end 范围内,以月为单位遍历.
TraverseTimeRangeByWeek 在 start ~ end 范围内,以周为单位遍历.
TraverseTimeRangeByYear 在 start ~ end 范围内,以年为单位遍历.
TruncateString Ref: https://dev.to/takakd/go-safe-truncate-string-9h0.
UrlJoin via https://stackoverflow.com/questions/34668012/combine-url-paths-with-path-join.

# Variables

bad request 错误的请求(参数错误).
server logic error 服务器内部错误, 服务器自身逻辑问题.
invalid params 参数格式错误.
invalid password 密码错误.
invalid verify code 验证码无效.
need login 需要登录.
no error 没错.
resource not found 资源不存在.
out of range 越界访问.
permission denied 权限不足.
too many requests 请求过于频繁, 限流.