cluade code review changes

This commit is contained in:
2026-02-20 16:38:24 +05:30
parent a048cb0d73
commit f1601020b1
16 changed files with 150 additions and 70 deletions

View File

@@ -35,10 +35,21 @@ func NumberParam[T Number](r *http.Request, key string) (T, error) {
return T(n), nil
}
// int param
// unsigned int param
if k >= reflect.Uint && k <= reflect.Uint64 {
n, err := strconv.ParseUint(p, 10, 64)
if err != nil {
return noop, fmt.Errorf("query param: %q is not a valid unsigned integer", key)
}
return T(n), nil
}
// signed int param
n, err := strconv.ParseInt(p, 10, 64)
if err != nil {
return noop, fmt.Errorf("query param: %q is not a valid integer", key)
}
return T(n), nil
}