go_dreamfactory/stress/helper/helper.go
2022-11-24 21:30:50 +08:00

24 lines
421 B
Go

// Package helper 帮助函数,时间、数组的通用处理
package helper
import (
"time"
)
// DiffNano 时间差,纳秒
func DiffNano(startTime time.Time) (diff int64) {
diff = int64(time.Since(startTime))
return
}
// InArrayStr 判断字符串是否在数组内
func InArrayStr(str string, arr []string) (inArray bool) {
for _, s := range arr {
if s == str {
inArray = true
break
}
}
return
}