mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-16 04:36:35 +08:00
feat: 机器定时删除终端操作记录
This commit is contained in:
17
server/pkg/utils/stringx/conv.go
Normal file
17
server/pkg/utils/stringx/conv.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package stringx
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// 将字符串值转为int值, 若value为空或者转换失败,则返回默认值
|
||||
func ConvInt(value string, defaultValue int) int {
|
||||
if value == "" {
|
||||
return defaultValue
|
||||
}
|
||||
if intV, err := strconv.Atoi(value); err != nil {
|
||||
return defaultValue
|
||||
} else {
|
||||
return intV
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user