gitlab.com/evatix-go/core@v1.3.55/chmodhelper/chmodins/Condition.go (about) 1 package chmodins 2 3 type Condition struct { 4 IsSkipOnInvalid bool `json:"IsSkipOnInvalid"` 5 IsContinueOnError bool `json:"IsContinueOnError"` 6 IsRecursive bool `json:"IsRecursive"` 7 } 8 9 func DefaultAllTrueCondition() *Condition { 10 return &Condition{ 11 IsSkipOnInvalid: true, 12 IsContinueOnError: true, 13 IsRecursive: true, 14 } 15 } 16 17 func DefaultAllFalseCondition() *Condition { 18 return &Condition{ 19 IsSkipOnInvalid: false, 20 IsContinueOnError: false, 21 IsRecursive: false, 22 } 23 } 24 25 // DefaultAllFalseExceptRecurse only IsRecursive will be true 26 func DefaultAllFalseExceptRecurse() *Condition { 27 return &Condition{ 28 IsSkipOnInvalid: false, 29 IsContinueOnError: false, 30 IsRecursive: true, 31 } 32 } 33 34 // IsExitOnInvalid 35 // 36 // returns true Condition is null or invert of IsSkipOnInvalid 37 func (it *Condition) IsExitOnInvalid() bool { 38 return it == nil || !it.IsSkipOnInvalid 39 } 40 41 // IsCollectErrorOnInvalid 42 // 43 // returns true Condition is null or invert of IsSkipOnInvalid 44 func (it *Condition) IsCollectErrorOnInvalid() bool { 45 return it == nil || !it.IsSkipOnInvalid 46 } 47 48 func (it *Condition) Clone() *Condition { 49 if it == nil { 50 return nil 51 } 52 53 return &Condition{ 54 IsSkipOnInvalid: it.IsSkipOnInvalid, 55 IsContinueOnError: it.IsContinueOnError, 56 IsRecursive: it.IsRecursive, 57 } 58 } 59 60 func (it Condition) CloneNonPtr() Condition { 61 return Condition{ 62 IsSkipOnInvalid: it.IsSkipOnInvalid, 63 IsContinueOnError: it.IsContinueOnError, 64 IsRecursive: it.IsRecursive, 65 } 66 }