parseUpdateEntityStringBoolField parses a FieldParsingTemplatableBool field from a config map. It pre-processes the value to normalise literal booleans to strings, then returns the value as *string. Returns nil when the field is absent.
(configMap map[string]any, fieldName string, debugLog *logger.Logger)
| 268 | // It pre-processes the value to normalise literal booleans to strings, then returns the value |
| 269 | // as *string. Returns nil when the field is absent. |
| 270 | func parseUpdateEntityStringBoolField(configMap map[string]any, fieldName string, debugLog *logger.Logger) *string { |
| 271 | if configMap == nil { |
| 272 | return nil |
| 273 | } |
| 274 | if _, exists := configMap[fieldName]; !exists { |
| 275 | return nil |
| 276 | } |
| 277 | if err := preprocessBoolFieldAsString(configMap, fieldName, debugLog); err != nil { |
| 278 | if debugLog != nil { |
| 279 | debugLog.Printf("Invalid %s value: %v", fieldName, err) |
| 280 | } |
| 281 | return nil |
| 282 | } |
| 283 | if strVal, ok := configMap[fieldName].(string); ok { |
| 284 | return &strVal |
| 285 | } |
| 286 | return nil |
| 287 | } |
| 288 | |
| 289 | // UpdateEntityFieldSpec defines a boolean field to be parsed from config |
| 290 | type UpdateEntityFieldSpec struct { |
no test coverage detected