摘要: 1. 统计模块耗时 start := time.Now() // 代码块 e.timeCost = time.Since(start).Seconds() cost := fmt.Sprintf("%.3f", e.timeCost) 2. 时间格式化 阅读全文
posted @ 2021-06-19 06:26 骑着蜗牛看海呀 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1. float64保留2位小数 加上 0.5是为了四舍五入,想保留几位小数的话把2改掉即可 func Decimal(value float64) float64 { value, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", value), 64) ret 阅读全文
posted @ 2021-06-19 06:23 骑着蜗牛看海呀 阅读(452) 评论(0) 推荐(0) 编辑