MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GetRestrictedIntQuery

Function GetRestrictedIntQuery

base/util.go:1517–1525  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
1517func 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
1527func GetRestrictedIntFromString(rawValue string, defaultValue, minValue, maxValue uint64, allowZero bool) uint64 {
1528 var value *uint64

Callers 4

handleChangesMethod · 0.92
getIntQueryMethod · 0.92

Calls 2

GetMethod · 0.45

Tested by 1