24 lines
421 B
Go
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
|
|
}
|