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

Method Into

pkg/attributes/attributes.go:288–300  ·  view source on GitHub ↗

Into allows decoding the whole attributes map into a given interface. The provided interface should be either a pointer to a struct, or to a map. An error is returned if the provided interface type is not compatible with the structure of the attributes

(into interface{})

Source from the content-addressed store, hash-verified

286// An error is returned if the provided interface type is not compatible
287// with the structure of the attributes
288func (attributes Attributes) Into(into interface{}) error {
289 if attributes == nil {
290 return nil
291 }
292
293 rawJSON, err := json.Marshal(attributes)
294 if err != nil {
295 return err
296 }
297
298 err = json.Unmarshal(rawJSON, into)
299 return err
300}
301
302// AsInterface allows returning the whole attributes map...
303// as an interface. When the attributes are not empty,

Callers 1

TestDecodeAttributesFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestDecodeAttributesFunction · 0.64