Documentation ¶
Index ¶
- func DownloadFile(ctx context.Context, url string, dirs, fileName string) error
- func DownloadFileWithLimit(ctx context.Context, url string, dirs, fileName string, maxBytes int64) error
- func FoldLog(content []byte) string
- func Retry(f RetryFunc) (err error)
- type GoroutinFunc
- type GoroutineHelp
- type IDGenerator
- type RecoverFunc
- type RetryFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
DownloadFile 下载网络文件到服务器本地
Types ¶
type GoroutineHelp ¶
type GoroutineHelp struct { }
GoroutineHelp ...
func (GoroutineHelp) Recover ¶
func (GoroutineHelp) Recover(recoverFunc RecoverFunc) error
Recover panic 并打印日志, recoverFunc 用来恢复的执行函数, usgae: defer misc.Recover(nil)
func (GoroutineHelp) SafeGo ¶
func (help GoroutineHelp) SafeGo(goFunc GoroutinFunc, recover bool)
SafeGo 安全启用携程,捕获 crash,并且重试。recover 表示捕获到异常的情况下是否需要重新开启新的携程。
type IDGenerator ¶
type IDGenerator struct { }
IDGenerator id 生成器
func (IDGenerator) BighumpToUnderscore ¶
func (gen IDGenerator) BighumpToUnderscore(param string) string
BighumpToUnderscore 大驼峰参数转换成下划线
func (IDGenerator) GenerateRandomString ¶
func (gen IDGenerator) GenerateRandomString(length int, alphanum []byte) string
GenerateRandomString 生成随机字符串, alphanum 字符集,nil 使用默认字符集。
func (IDGenerator) GenerateUUID ¶
func (gen IDGenerator) GenerateUUID(includeSeparator bool) string
GenerateUUID 生成UUID
func (IDGenerator) UnderscoreToBighump ¶
func (gen IDGenerator) UnderscoreToBighump(param string) string
UnderscoreToBighump 下划线参数转换成大驼峰
Click to show internal directories.
Click to hide internal directories.