v1
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package convertor
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
@@ -23,13 +22,8 @@ func Bool(value string, defaultValue bool) bool {
|
||||
return b
|
||||
}
|
||||
|
||||
func QueryInt[T int | int16 | int32 | int64](vars url.Values, key string, defaultValue T) T {
|
||||
v := vars.Get(key)
|
||||
if len(v) == 0 {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
i, err := strconv.Atoi(v)
|
||||
func QueryInt[T int | int16 | int32 | int64](value string, defaultValue T) T {
|
||||
i, err := strconv.Atoi(value)
|
||||
if err != nil {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user