mirror of
https://github.com/kopia/kopia.git
synced 2026-03-27 10:32:08 -04:00
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.
18 lines
368 B
Go
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
|
|
}
|