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

Function GetRestrictedInt

base/util.go:1547–1569  ·  view source on GitHub ↗
(rawValue *uint64, defaultValue, minValue, maxValue uint64, allowZero bool)

Source from the content-addressed store, hash-verified

1545}
1546
1547func GetRestrictedInt(rawValue *uint64, defaultValue, minValue, maxValue uint64, allowZero bool) uint64 {
1548
1549 var value uint64
1550
1551 // Only use the defaultValue if rawValue isn't specified.
1552 if rawValue == nil {
1553 value = defaultValue
1554 } else {
1555 value = *rawValue
1556 }
1557
1558 // If value is zero and allowZero=true, leave value at zero rather than forcing it to the minimum value
1559 validZero := (value == 0 && allowZero)
1560 if value < minValue && !validZero {
1561 value = minValue
1562 }
1563
1564 if value > maxValue && maxValue > 0 {
1565 value = maxValue
1566 }
1567
1568 return value
1569}
1570
1571// GetHttpClient returns a new HTTP client with TLS certificate verification
1572// disabled when insecureSkipVerify is true and enabled otherwise.

Callers 3

handleSetLoggingMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected