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{})
| 286 | // An error is returned if the provided interface type is not compatible |
| 287 | // with the structure of the attributes |
| 288 | func (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, |
no outgoing calls