This commit is contained in:
2025-03-31 11:59:42 +08:00
parent 963e1e005e
commit 6fb06c456c
52 changed files with 2244 additions and 753 deletions

View File

@@ -13,6 +13,15 @@ func ConvertInt[T int | int16 | int32 | int64](value string, defaultValue T) T {
return T(i)
}
func ConvertBool(value string, defaultValue bool) bool {
b, err := strconv.ParseBool(value)
if err != nil {
return defaultValue
}
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 {