gitlab.com/evatix-go/core@v1.3.55/coretaskinfo/ExcludingOptions.go (about) 1 package coretaskinfo 2 3 type ExcludingOptions struct { 4 IsExcludeRootName, 5 IsExcludeDescription, 6 IsExcludeUrl, 7 IsExcludeHintUrl, 8 IsExcludeErrorUrl, 9 IsExcludeAdditionalErrorWrap, 10 IsExcludeExampleUrl, 11 IsExcludeSingleExample, 12 IsExcludeExamples, 13 IsSecureText bool // indicates secure text, invert means log payload, plain text. it will not log payload 14 } 15 16 func (it *ExcludingOptions) IsSafeExcludeRootName() bool { 17 return it != nil && it.IsExcludeRootName 18 } 19 20 func (it *ExcludingOptions) IsSafeExcludeDescription() bool { 21 return it != nil && it.IsExcludeDescription 22 } 23 24 func (it *ExcludingOptions) IsSafeExcludeUrl() bool { 25 return it != nil && it.IsExcludeUrl 26 } 27 28 func (it *ExcludingOptions) IsSafeExcludeErrorUrl() bool { 29 return it != nil && it.IsExcludeErrorUrl 30 } 31 32 func (it *ExcludingOptions) IsSafeExcludeAdditionalErrorWrap() bool { 33 return it != nil && it.IsExcludeAdditionalErrorWrap 34 } 35 36 func (it *ExcludingOptions) IsSafeExcludeHintUrl() bool { 37 return it != nil && it.IsExcludeHintUrl 38 } 39 40 func (it *ExcludingOptions) IsSafeExcludeExampleUrl() bool { 41 return it != nil && it.IsExcludeExampleUrl 42 } 43 44 func (it *ExcludingOptions) IsSafeExcludeSingleExample() bool { 45 return it != nil && it.IsExcludeSingleExample 46 } 47 48 func (it *ExcludingOptions) IsSafeExcludeExamples() bool { 49 return it != nil && it.IsExcludeExamples 50 } 51 52 func (it *ExcludingOptions) IsSafeSecureText() bool { 53 return it != nil && it.IsSecureText 54 } 55 56 func (it *ExcludingOptions) SetSecure() *ExcludingOptions { 57 if it == nil { 58 return &ExcludingOptions{ 59 IsSecureText: true, 60 } 61 } 62 63 it.IsSecureText = true 64 65 return it 66 } 67 68 func (it *ExcludingOptions) SetPlainText() *ExcludingOptions { 69 if it == nil { 70 return &ExcludingOptions{} // plain text 71 } 72 73 it.IsSecureText = false 74 75 return it 76 } 77 78 func (it *ExcludingOptions) IsEmpty() bool { 79 return it == nil || 80 !it.IsExcludeRootName && 81 !it.IsExcludeDescription && 82 !it.IsExcludeUrl && 83 !it.IsExcludeHintUrl && 84 !it.IsExcludeErrorUrl && 85 !it.IsExcludeAdditionalErrorWrap && 86 !it.IsExcludeExampleUrl && 87 !it.IsExcludeSingleExample && 88 !it.IsExcludeExamples && 89 !it.IsSecureText 90 } 91 92 func (it *ExcludingOptions) IsZero() bool { 93 return it == nil || 94 !it.IsExcludeRootName && 95 !it.IsExcludeDescription && 96 !it.IsExcludeUrl && 97 !it.IsExcludeHintUrl && 98 !it.IsExcludeErrorUrl && 99 !it.IsExcludeAdditionalErrorWrap && 100 !it.IsExcludeExampleUrl && 101 !it.IsExcludeSingleExample && 102 !it.IsExcludeExamples && 103 !it.IsSecureText 104 } 105 106 func (it *ExcludingOptions) IsIncludeRootName() bool { 107 return it == nil || !it.IsExcludeRootName 108 } 109 110 func (it *ExcludingOptions) IsIncludeDescription() bool { 111 return it == nil || !it.IsExcludeDescription 112 } 113 114 func (it *ExcludingOptions) IsIncludeUrl() bool { 115 return it == nil || !it.IsExcludeUrl 116 } 117 118 func (it *ExcludingOptions) IsIncludeHintUrl() bool { 119 return it == nil || !it.IsExcludeHintUrl 120 } 121 122 func (it *ExcludingOptions) IsIncludeErrorUrl() bool { 123 return it == nil || !it.IsExcludeErrorUrl 124 } 125 126 func (it *ExcludingOptions) IsIncludeExampleUrl() bool { 127 return it == nil || !it.IsExcludeExampleUrl 128 } 129 130 func (it *ExcludingOptions) IsIncludeSingleExample() bool { 131 return it == nil || !it.IsExcludeSingleExample 132 } 133 134 func (it *ExcludingOptions) IsIncludeExamples() bool { 135 return it == nil || !it.IsExcludeExamples 136 } 137 138 func (it *ExcludingOptions) IsIncludeAdditionalErrorWrap() bool { 139 return it == nil || !it.IsExcludeAdditionalErrorWrap 140 } 141 142 func (it *ExcludingOptions) IsIncludePayloads() bool { 143 return it == nil || !it.IsSecureText 144 } 145 146 func (it ExcludingOptions) ToPtr() *ExcludingOptions { 147 return &it 148 } 149 150 func (it ExcludingOptions) ToNonPtr() ExcludingOptions { 151 return it 152 } 153 154 func (it ExcludingOptions) Clone() ExcludingOptions { 155 return ExcludingOptions{ 156 IsExcludeRootName: it.IsExcludeRootName, 157 IsExcludeDescription: it.IsExcludeDescription, 158 IsExcludeUrl: it.IsExcludeUrl, 159 IsExcludeHintUrl: it.IsExcludeHintUrl, 160 IsExcludeErrorUrl: it.IsExcludeErrorUrl, 161 IsExcludeAdditionalErrorWrap: it.IsExcludeAdditionalErrorWrap, 162 IsExcludeExampleUrl: it.IsExcludeExampleUrl, 163 IsExcludeSingleExample: it.IsExcludeSingleExample, 164 IsExcludeExamples: it.IsExcludeExamples, 165 IsSecureText: it.IsSecureText, 166 } 167 } 168 169 func (it *ExcludingOptions) ClonePtr() *ExcludingOptions { 170 if it == nil { 171 return &ExcludingOptions{} 172 } 173 174 return &ExcludingOptions{ 175 IsExcludeRootName: it.IsExcludeRootName, 176 IsExcludeDescription: it.IsExcludeDescription, 177 IsExcludeUrl: it.IsExcludeUrl, 178 IsExcludeHintUrl: it.IsExcludeHintUrl, 179 IsExcludeErrorUrl: it.IsExcludeErrorUrl, 180 IsExcludeAdditionalErrorWrap: it.IsExcludeAdditionalErrorWrap, 181 IsExcludeExampleUrl: it.IsExcludeExampleUrl, 182 IsExcludeSingleExample: it.IsExcludeSingleExample, 183 IsExcludeExamples: it.IsExcludeExamples, 184 IsSecureText: it.IsSecureText, 185 } 186 }