FromMap allows adding into the current map of attributes all the attributes contained in the given map of interfaces each attribute of the given map 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
(strings map[string]interface{}, errorHolder *error)
| 435 | // to receive any error that might have occured during the attributes |
| 436 | // decoding |
| 437 | func (attributes Attributes) FromMap(strings map[string]interface{}, errorHolder *error) Attributes { |
| 438 | for key, value := range strings { |
| 439 | // Here only the last error is returned. |
| 440 | // Let's keep it simple and avoid adding a dependency |
| 441 | // on an external package just for gathering errors. |
| 442 | attributes.Put(key, value, errorHolder) |
| 443 | } |
| 444 | return attributes |
| 445 | } |
| 446 | |
| 447 | // FromInterface allows completing the map of attributes from the given interface. |
| 448 | // The given interface, and can be any value |