Node represents an element in the YAML document hierarchy. While documents are typically encoded and decoded into higher level types, such as structs and maps, Node is an intermediate representation that allows detailed control over the content being decoded or encoded. It's worth noting that altho
| 370 | // err := yaml.Unmarshal(data, &person) |
| 371 | // |
| 372 | type Node struct { |
| 373 | // Kind defines whether the node is a document, a mapping, a sequence, |
| 374 | // a scalar value, or an alias to another node. The specific data type of |
| 375 | // scalar nodes may be obtained via the ShortTag and LongTag methods. |
| 376 | Kind Kind |
| 377 | |
| 378 | // Style allows customizing the apperance of the node in the tree. |
| 379 | Style Style |
| 380 | |
| 381 | // Tag holds the YAML tag defining the data type for the value. |
| 382 | // When decoding, this field will always be set to the resolved tag, |
| 383 | // even when it wasn't explicitly provided in the YAML content. |
| 384 | // When encoding, if this field is unset the value type will be |
| 385 | // implied from the node properties, and if it is set, it will only |
| 386 | // be serialized into the representation if TaggedStyle is used or |
| 387 | // the implicit tag diverges from the provided one. |
| 388 | Tag string |
| 389 | |
| 390 | // Value holds the unescaped and unquoted represenation of the value. |
| 391 | Value string |
| 392 | |
| 393 | // Anchor holds the anchor name for this node, which allows aliases to point to it. |
| 394 | Anchor string |
| 395 | |
| 396 | // Alias holds the node that this alias points to. Only valid when Kind is AliasNode. |
| 397 | Alias *Node |
| 398 | |
| 399 | // Content holds contained nodes for documents, mappings, and sequences. |
| 400 | Content []*Node |
| 401 | |
| 402 | // HeadComment holds any comments in the lines preceding the node and |
| 403 | // not separated by an empty line. |
| 404 | HeadComment string |
| 405 | |
| 406 | // LineComment holds any comments at the end of the line where the node is in. |
| 407 | LineComment string |
| 408 | |
| 409 | // FootComment holds any comments following the node and before empty lines. |
| 410 | FootComment string |
| 411 | |
| 412 | // Line and Column hold the node position in the decoded YAML text. |
| 413 | // These fields are not respected when encoding the node. |
| 414 | Line int |
| 415 | Column int |
| 416 | } |
| 417 | |
| 418 | // IsZero returns whether the node has all of its fields unset. |
| 419 | func (n *Node) IsZero() bool { |
nothing calls this directly
no outgoing calls
no test coverage detected