first commit
This commit is contained in:
11
internal/pkg/convertor/http_form.go
Normal file
11
internal/pkg/convertor/http_form.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package convertor
|
||||
|
||||
import "strconv"
|
||||
|
||||
func ConvertInt[T int | int16 | int32 | int64](value string, defaultValue T) T {
|
||||
i, err := strconv.Atoi(value)
|
||||
if err != nil {
|
||||
return defaultValue
|
||||
}
|
||||
return T(i)
|
||||
}
|
||||
Reference in New Issue
Block a user