GetRestrictedIntQuery returns the integer value of a URL query, restricted to a min and max value, but returning 0 if missing or unparseable. If allowZero is true, values coming in as zero will stay zero, instead of being set to the minValue.
(values url.Values, query string, defaultValue, minValue, maxValue uint64, allowZero bool)
| 1515 | // but returning 0 if missing or unparseable. If allowZero is true, values coming in |
| 1516 | // as zero will stay zero, instead of being set to the minValue. |
| 1517 | func GetRestrictedIntQuery(values url.Values, query string, defaultValue, minValue, maxValue uint64, allowZero bool) uint64 { |
| 1518 | return GetRestrictedIntFromString( |
| 1519 | values.Get(query), |
| 1520 | defaultValue, |
| 1521 | minValue, |
| 1522 | maxValue, |
| 1523 | allowZero, |
| 1524 | ) |
| 1525 | } |
| 1526 | |
| 1527 | func GetRestrictedIntFromString(rawValue string, defaultValue, minValue, maxValue uint64, allowZero bool) uint64 { |
| 1528 | var value *uint64 |