parseUint64 reads the value for given URL parameter from request and parses it into uint64, empty string is converted into zero value
(r *http.Request, name string)
| 89 | // parseUint64 reads the value for given URL parameter from request and |
| 90 | // parses it into uint64, empty string is converted into zero value |
| 91 | func parseUint64(r *http.Request, name string) (uint64, error) { |
| 92 | value := r.URL.Query().Get(name) |
| 93 | if value == "" { |
| 94 | return 0, nil |
| 95 | } |
| 96 | |
| 97 | uintVal, err := strconv.ParseUint(value, 0, 64) |
| 98 | if err != nil { |
| 99 | return 0, errors.Wrapf(err, "while parsing %s as uint64", name) |
| 100 | } |
| 101 | |
| 102 | return uintVal, nil |
| 103 | } |
| 104 | |
| 105 | // parseBool reads the value for given URL parameter from request and |
| 106 | // parses it into bool, empty string is converted into zero value |
no test coverage detected
searching dependent graphs…