Debian Codegraph @

node.go

raw symbols SCIP
1 package yaml
2
3 import "go.yaml.in/yaml/v4/internal/libyaml"
4
5 // -----------------------------------------------------------------------------
6 // Node-related type aliases and constants
7 // -----------------------------------------------------------------------------
8 type (
9 // Node represents an element in the YAML document hierarchy.
10 // While documents are typically encoded and decoded into higher level
11 // types, such as structs and maps, Node is an intermediate representation
12 // that allows detailed control over the content being decoded or encoded.
13 //
14 // It's worth noting that although Node offers access into details such as
15 // line numbers, columns, and comments, the content when re-encoded will
16 // not have its original textual representation preserved.
17 // An effort is made to render the data pleasantly, and to preserve
18 // comments near the data they describe, though.
19 //
20 // Values that make use of the Node type interact with the yaml package in
21 // the same way any other type would do, by encoding and decoding yaml data
22 // directly or indirectly into them.
23 //
24 // For example:
25 //
26 // var person struct {
27 // Name string
28 // Address yaml.Node
29 // }
30 // err := yaml.Unmarshal(data, &person)
31 //
32 // Or by itself:
33 //
34 // var person Node
35 // err := yaml.Unmarshal(data, &person)
36 Node = libyaml.Node
37
38 // Kind represents the type of YAML node.
39 Kind = libyaml.Kind
40
41 // Style represents the formatting style of a YAML node.
42 Style = libyaml.Style
43
44 // Marshaler interface may be implemented by types to customize their
45 // behavior when being marshaled into a YAML document.
46 Marshaler = libyaml.Marshaler
47
48 // Unmarshaler is the interface implemented by types that can unmarshal
49 // a YAML description of themselves.
50 Unmarshaler = libyaml.Unmarshaler
51
52 // IsZeroer is used to check whether an object is zero to determine whether
53 // it should be omitted when marshaling with the ,omitempty flag.
54 // One notable implementation is [time.Time].
55 IsZeroer = libyaml.IsZeroer
56 )
57
58 // Kind constants define the different types of YAML nodes.
59 const (
60 // DocumentNode represents the root of a YAML document.
61 DocumentNode = libyaml.DocumentNode
62
63 // SequenceNode represents a YAML sequence (list).
64 SequenceNode = libyaml.SequenceNode
65
66 // MappingNode represents a YAML mapping (dictionary).
67 MappingNode = libyaml.MappingNode
68
69 // ScalarNode represents a YAML scalar value.
70 ScalarNode = libyaml.ScalarNode
71
72 // AliasNode represents a reference to an anchored node.
73 AliasNode = libyaml.AliasNode
74
75 // StreamNode represents a container for multiple YAML documents.
76 StreamNode = libyaml.StreamNode
77 )
78
79 // Style constants define different formatting styles for YAML nodes.
80 const (
81 // TaggedStyle explicitly shows the tag on the node.
82 TaggedStyle = libyaml.TaggedStyle
83
84 // DoubleQuotedStyle uses double quotes for scalar values.
85 DoubleQuotedStyle = libyaml.DoubleQuotedStyle
86
87 // SingleQuotedStyle uses single quotes for scalar values.
88 SingleQuotedStyle = libyaml.SingleQuotedStyle
89
90 // LiteralStyle uses literal block scalar style (|).
91 LiteralStyle = libyaml.LiteralStyle
92
93 // FoldedStyle uses folded block scalar style (>).
94 FoldedStyle = libyaml.FoldedStyle
95
96 // FlowStyle uses flow style (inline) formatting.
97 FlowStyle = libyaml.FlowStyle
98 )