Files
kopia/snapshot/policy/optional.go
Jarek Kowalski 93930d20cb policy: revamped policy merge mechanism (#1538)
Added policy.Definition which allows us to precisely report where
each piece of policy came from.

Fixed a one-off bug with "noParent", which prevented merging of parent
policies one level too soon.

Added a whole bunch of merging helpers and generic reflection-based
test that ensures every single merge is tested.
2021-11-27 18:14:45 -08:00

18 lines
368 B
Go

package policy
// OptionalBool provides convenience methods for manipulating optional booleans.
type OptionalBool bool
// OrDefault returns the value of the boolean or provided default if it's nil.
func (b *OptionalBool) OrDefault(def bool) bool {
if b == nil {
return def
}
return bool(*b)
}
func newOptionalBool(b OptionalBool) *OptionalBool {
return &b
}