MCPcopy Create free account
hub / github.com/devfile/api / Strings

Method Strings

pkg/attributes/attributes.go:231–242  ·  view source on GitHub ↗

Strings allows returning only the attributes whose content is a JSON string. An optional error holder can be passed as an argument to receive any error that might have be raised during the attribute decoding

(errorHolder *error)

Source from the content-addressed store, hash-verified

229// to receive any error that might have be raised during the attribute
230// decoding
231func (attributes Attributes) Strings(errorHolder *error) map[string]string {
232 result := map[string]string{}
233 for key := range attributes {
234 // Here only the last error is returned.
235 // Let's keep it simple and avoid adding a dependency
236 // on an external package just for gathering errors.
237 if value, isRightType := attributes.Get(key, errorHolder).(string); isRightType {
238 result[key] = value
239 }
240 }
241 return result
242}
243
244// Numbers allows returning only the attributes whose content
245// is a JSON number.

Callers 3

newInvalidKeysErrorFunction · 0.80
TestDecodeAttributesFunction · 0.80

Calls 1

GetMethod · 0.95

Tested by 1

TestDecodeAttributesFunction · 0.64