MCPcopy Create free account
hub / github.com/github/gh-aw / parseUpdateEntityStringBoolField

Function parseUpdateEntityStringBoolField

pkg/workflow/update_entity_helpers.go:270–287  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
270func 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
290type UpdateEntityFieldSpec struct {

Callers 1

Calls 2

PrintfMethod · 0.45

Tested by

no test coverage detected