UpdateNodeValuesFromJSON sets the container's fields to the provided values.
(raw json.RawMessage, prefix string, group node.UiNodeGroup)
| 297 | |
| 298 | // UpdateNodeValuesFromJSON sets the container's fields to the provided values. |
| 299 | func (c *Container) UpdateNodeValuesFromJSON(raw json.RawMessage, prefix string, group node.UiNodeGroup) { |
| 300 | for k, v := range jsonx.Flatten(raw) { |
| 301 | k = addPrefix(k, prefix, ".") |
| 302 | |
| 303 | if n := c.Nodes.Find(k); n != nil { |
| 304 | n.Attributes.SetValue(v) |
| 305 | n.Group = group |
| 306 | continue |
| 307 | } |
| 308 | |
| 309 | c.Nodes.Upsert(node.NewInputFieldFromJSON(k, v, group)) |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | // Unset removes a field from the container. |
| 314 | func (c *Container) UnsetNode(id string) { |