(attr file.FormFile)
| 383 | } |
| 384 | |
| 385 | func (node *Node) SetAttributes(attr file.FormFile) (err error) { |
| 386 | defer attr.Remove() |
| 387 | attributes, err := ioutil.ReadFile(attr.Path) |
| 388 | if err != nil { |
| 389 | return |
| 390 | } |
| 391 | err = json.Unmarshal(attributes, &node.Attributes) |
| 392 | if err != nil { |
| 393 | return |
| 394 | } |
| 395 | return |
| 396 | } |
| 397 | |
| 398 | func (node *Node) SetAttributesFromString(attributes string) (err error) { |
| 399 | err = json.Unmarshal([]byte(attributes), &node.Attributes) |