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

Method Put

pkg/attributes/attributes.go:417–427  ·  view source on GitHub ↗

Put allows adding an attribute to the current map of attributes. The attribute is provided as an interface, and can be any value that supports Json Marshaling. An optional error holder can be passed as an argument to receive any error that might have occured during the attributes decoding

(key string, value interface{}, errorHolder *error)

Source from the content-addressed store, hash-verified

415// to receive any error that might have occured during the attributes
416// decoding
417func (attributes Attributes) Put(key string, value interface{}, errorHolder *error) Attributes {
418 rawJSON, err := json.Marshal(value)
419 if err != nil && errorHolder != nil {
420 *errorHolder = err
421 }
422
423 attributes[key] = apiext.JSON{
424 Raw: rawJSON,
425 }
426 return attributes
427}
428
429// FromMap allows adding into the current map of attributes all
430// the attributes contained in the given map of interfaces

Callers 3

FromMapMethod · 0.95
attributes_test.goFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected