mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 12:52:28 +08:00
WriteCsvFile自定义分割符,增加map切片写入csv,增加追踪函数运行时间的函数 (#157)
* WriteCsvFile now support custom delimiter,Add write map slice to csv * add trace func time
This commit is contained in:
@@ -381,3 +381,12 @@ func TimestampNano(timezone ...string) int64 {
|
||||
|
||||
return t.UnixNano()
|
||||
}
|
||||
|
||||
// TraceFuncTime: trace the func costed time,just call it at top of the func like `defer TraceFuncTime()()`
|
||||
func TraceFuncTime() func() {
|
||||
pre := time.Now()
|
||||
return func() {
|
||||
elapsed := time.Since(pre)
|
||||
fmt.Println("Costs Time:\t", elapsed)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user