Debian Codegraph @

parsing/toml/toml_reader.go

raw symbols SCIP
1 package tomlscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/
2
3 import (
4 "bytesscip-go gomod github.com/golang/go/src go1.25 bytes/"
5 "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/"
6 "strconvscip-go gomod github.com/golang/go/src go1.25 strconv/"
7
8 "github.com/pelletier/go-toml/v2/unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/"
9 "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/"
10 "github.com/tomwright/dasel/v3/parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/"
11 )
12
13 var _ parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Readerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader# = (*tomlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#)(nil)
14
15 func newTOMLReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/newTOMLReader().(options parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.ReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/ReaderOptions#) (parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/.Readerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#, error) {
16 return &tomlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#{}, nil
17 }
18
19 const (
20 tomlStringStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleKey. = "toml_string_style"
21
22 tomlStringStyleMultilineLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleMultilineLiteral. = "multiline_literal"
23 tomlStringStyleMultilineBasicscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleMultilineBasic. = "multiline_basic"
24 tomlStringStyleLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleLiteral. = "literal"
25 tomlStringStyleBasicscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleBasic. = "basic"
26
27 tomlTableStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleKey. = "toml_table_style"
28 tomlTableStyleStandardscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleStandard. = "standard"
29 tomlTableStyleArrayscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleArray. = "array"
30 tomlTableStyleInlinescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleInline. = "inline"
31 )
32
33 type tomlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader# struct{}
34
35 // Read reads a value from a byte slice.
36 func (j *tomlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#) Readscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#Read().(data []byte) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) {
37 p := &unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Parserscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#{}
38 p.Resetscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#Reset().(data)
39
40 root := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
41
42 var active *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#
43
44 for p.NextExpressionscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#NextExpression().() {
45 expr := p.Expressionscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#Expression().()
46 switch expr.Kindscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Kind. {
47 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Invalidscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Invalid., unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Commentscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Comment.:
48 // ignore
49 continue
50 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.KeyValuescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/KeyValue.:
51 keyParts, val, err := j.parseKeyValueNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#parseKeyValueNode().(p, expr)
52 if err != nil {
53 return nil, err
54 }
55 if active != nil {
56 if err := setDottedKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/setDottedKey().(root, active, keyParts, val); err != nil {
57 return nil, err
58 }
59 } else {
60 if err := setDottedKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/setDottedKey().(root, nil, keyParts, val); err != nil {
61 return nil, err
62 }
63 }
64
65 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Tablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Table.:
66 parts, quoted, err := extractKeyFromTableNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/extractKeyFromTableNode().(p, expr)
67 if err != nil {
68 return nil, err
69 }
70 m, err := ensureMapAtscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/ensureMapAt().(root, parts)
71 if err != nil {
72 return nil, err
73 }
74 // Record table header parts and quoting info on the map so the writer
75 // can reproduce the header exactly if needed.
76 m.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().(tomlTableStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleKey., tomlTableStyleStandardscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleStandard.)
77 m.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().("toml_table_header_parts", parts)
78 m.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().("toml_table_header_quoted", quoted)
79 active = m
80
81 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.ArrayTablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/ArrayTable.:
82 parts, quoted, err := extractKeyFromTableNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/extractKeyFromTableNode().(p, expr)
83 if err != nil {
84 return nil, err
85 }
86 slice, err := ensureSliceAtscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/ensureSliceAt().(root, parts)
87 if err != nil {
88 return nil, err
89 }
90 obj := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
91 // Mark this object as created via an array table so the writer can
92 // emit [[...]] headers for it.
93 obj.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().(tomlTableStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleKey., tomlTableStyleArrayscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleArray.)
94 obj.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().("toml_table_header_parts", parts)
95 obj.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().("toml_table_header_quoted", quoted)
96 if err := slice.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(obj); err != nil {
97 return nil, err
98 }
99 active = obj
100
101 default:
102 // top-level value nodes are unexpected; ignore
103 }
104 }
105
106 return root, nil
107 }
108
109 // readNode parses a value node (not table/keyvalue headers).
110 func (j *tomlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#) readNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#readNode().(p *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Parserscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#, n *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#) (string, *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) {
111 switch n.Kindscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Kind. {
112 // Meta
113 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Invalidscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Invalid.:
114 return "", nil, nil
115 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Commentscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Comment.:
116 return "", nil, nil
117 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Keyscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Key.:
118 return "", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.)), nil
119
120 // Container values
121 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Arrayscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Array.:
122 v, err := j.readArrayValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#readArrayValue().(p, n)
123 return "", v, err
124 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.InlineTablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/InlineTable.:
125 return j.readInlineTablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#readInlineTable().(p, n)
126
127 // Values
128 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Stringscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/String.:
129 v := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.))
130
131 raw := p.Rawscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#Raw().(n.Rawscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Raw.)
132 switch {
133 case len(raw) >= 3 && bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 bytes/HasPrefix().(raw, []byte("''")) && bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 bytes/HasPrefix().(raw, []byte("'''")):
134 v.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().(tomlStringStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleKey., tomlStringStyleMultilineLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleMultilineLiteral.)
135 case len(raw) >= 3 && bytesscip-go gomod github.com/golang/go/src go1.25 bytes/.HasPrefixscip-go gomod github.com/golang/go/src go1.25 bytes/HasPrefix().(raw, []byte("\"\"\"")):
136 v.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().(tomlStringStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleKey., tomlStringStyleMultilineBasicscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleMultilineBasic.)
137 case len(raw) >= 1 && raw[0] == '\'':
138 v.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().(tomlStringStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleKey., tomlStringStyleLiteralscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleLiteral.)
139 default:
140 v.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().(tomlStringStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleKey., tomlStringStyleBasicscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlStringStyleBasic.)
141 }
142
143 return "", v, nil
144 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Boolscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Bool.:
145 return "", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewBoolValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewBoolValue().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.) == "true"), nil
146 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Floatscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Float.:
147 f, err := strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseFloatscip-go gomod github.com/golang/go/src go1.25 strconv/ParseFloat().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.), 64)
148 if err != nil {
149 return "", nil, err
150 }
151 return "", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewFloatValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewFloatValue().(f), nil
152 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Integerscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Integer.:
153 i64, err := strconvscip-go gomod github.com/golang/go/src go1.25 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25 strconv/ParseInt().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.), 0, 64)
154 if err != nil {
155 return "", nil, err
156 }
157 return "", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewIntValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewIntValue().(int64(i64)), nil
158 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.LocalDatescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/LocalDate.:
159 return "", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.)), nil
160 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.LocalTimescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/LocalTime.:
161 return "", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.)), nil
162 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.LocalDateTimescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/LocalDateTime.:
163 return "", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.)), nil
164 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.DateTimescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/DateTime.:
165 return "", modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(string(n.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.)), nil
166 default:
167 return "", nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("unhandled node kind: %s", n.Kindscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Kind..Stringscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Kind#String().())
168 }
169 }
170
171 // parseKeyValueNode extracts the key segments and value from a KeyValue node without consuming parser expressions.
172 func (j *tomlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#) parseKeyValueNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#parseKeyValueNode().(p *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Parserscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#, n *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#) ([]string, *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) {
173 i := n.Childrenscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Children().()
174 var keyParts []string
175 var val *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#
176
177 for i.Nextscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Iterator#Next().() {
178 child := i.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Iterator#Node().()
179 if child.Kindscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Kind. == unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Keyscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Key. {
180 keyParts = append(keyParts, string(child.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.))
181 continue
182 }
183 _, v, err := j.readNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#readNode().(p, child)
184 if err != nil {
185 return nil, nil, err
186 }
187 val = v
188 }
189
190 if len(keyParts) == 0 {
191 return nil, nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("missing key in key/value node")
192 }
193 if val == nil {
194 return nil, nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("missing value in key/value node")
195 }
196
197 return keyParts, val, nil
198 }
199
200 // extractKeyFromTableNode returns the key segments from a Table/ArrayTable node.
201 func extractKeyFromTableNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/extractKeyFromTableNode().(p *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Parserscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#, n *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#) ([]string, []bool, error) {
202 i := n.Childrenscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Children().()
203 var parts []string
204 var quoted []bool
205 for i.Nextscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Iterator#Next().() {
206 child := i.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Iterator#Node().()
207 if child.Kindscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Kind. == unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Keyscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Key. {
208 parts = append(parts, string(child.Datascip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Data.))
209 raw := p.Rawscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#Raw().(child.Rawscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Raw.)
210 isQuoted := false
211 if len(raw) > 0 && (raw[0] == '"' || raw[0] == '\'') {
212 isQuoted = true
213 }
214 quoted = append(quoted, isQuoted)
215 continue
216 }
217 return nil, nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("expected table child node, got %s", child.Kindscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Kind..Stringscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Kind#String().())
218 }
219 if len(parts) == 0 {
220 return nil, nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("missing table child key node")
221 }
222 return parts, quoted, nil
223 }
224
225 // ensureMapAt ensures a map exists at the dotted path under root and returns it.
226 func ensureMapAtscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/ensureMapAt().(root *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, path []string) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) {
227 if len(path) == 0 {
228 return root, nil
229 }
230 cur := root
231 for _, seg := range path {
232 exists, err := cur.MapKeyExistsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MapKeyExists().(seg)
233 if err != nil {
234 return nil, err
235 }
236 if !exists {
237 m := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
238 if err := cur.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(seg, m); err != nil {
239 return nil, err
240 }
241 cur = m
242 continue
243 }
244 next, err := cur.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().(seg)
245 if err != nil {
246 return nil, err
247 }
248 if next.IsSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsSlice().() {
249 sliceLen, err := next.Lenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Len().()
250 if err != nil {
251 return nil, err
252 }
253 next, err = next.GetSliceIndexscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetSliceIndex().(sliceLen - 1)
254 if err != nil {
255 return nil, err
256 }
257 }
258 if !next.IsMapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsMap().() {
259 return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("conflicting types at path '%s': expected map", seg)
260 }
261 cur = next
262 }
263 return cur, nil
264 }
265
266 // ensureSliceAt ensures a slice exists at the dotted path under root and returns it.
267 func ensureSliceAtscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/ensureSliceAt().(root *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, path []string) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) {
268 if len(path) == 0 {
269 return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("empty path for array table")
270 }
271 parentPath := path[:len(path)-1]
272 finalSeg := path[len(path)-1]
273 parent, err := ensureMapAtscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/ensureMapAt().(root, parentPath)
274 if err != nil {
275 return nil, err
276 }
277 exists, err := parent.MapKeyExistsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MapKeyExists().(finalSeg)
278 if err != nil {
279 return nil, err
280 }
281 if !exists {
282 s := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
283 if err := parent.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(finalSeg, s); err != nil {
284 return nil, err
285 }
286 return s, nil
287 }
288 v, err := parent.GetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#GetMapKey().(finalSeg)
289 if err != nil {
290 return nil, err
291 }
292 if !v.IsSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsSlice().() {
293 return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("conflicting types at path '%s': expected slice", finalSeg)
294 }
295 return v, nil
296 }
297
298 // setDottedKey sets a value at a (possibly dotted) key within the given container (creating intermediate maps).
299 // If active is non-nil, it is the current table object to set keys relative to; root is only used when active is nil to
300 // create implicit parent maps on the root.
301 func setDottedKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/setDottedKey().(root, active *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, parts []string, val *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) error {
302 if len(parts) == 0 {
303 return fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("empty key")
304 }
305 // If active table provided, we should set relative to it. But parts may be dotted (i.e., multiple segments).
306 if active != nil {
307 if len(parts) == 1 {
308 return active.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(parts[0], val)
309 }
310 parent, err := ensureMapAtscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/ensureMapAt().(active, parts[:len(parts)-1])
311 if err != nil {
312 return err
313 }
314 return parent.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(parts[len(parts)-1], val)
315 }
316 // No active table: set on root
317 if len(parts) == 1 {
318 return root.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(parts[0], val)
319 }
320 parent, err := ensureMapAtscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/ensureMapAt().(root, parts[:len(parts)-1])
321 if err != nil {
322 return err
323 }
324 return parent.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(parts[len(parts)-1], val)
325 }
326
327 func (j *tomlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#) readInlineTablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#readInlineTable().(p *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Parserscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#, n *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#) (string, *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) {
328 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewMapValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewMapValue().()
329 res.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().(tomlTableStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleKey., tomlTableStyleInlinescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleInline.)
330
331 i := n.Childrenscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Children().()
332 for i.Nextscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Iterator#Next().() {
333 childNode := i.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Iterator#Node().()
334 // Inline table children are key/value pairs. Handle KeyValue specially.
335 switch childNode.Kindscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Kind. {
336 case unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.KeyValuescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/KeyValue.:
337 kparts, v, err := j.parseKeyValueNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#parseKeyValueNode().(p, childNode)
338 if err != nil {
339 return "", nil, err
340 }
341 if err := setDottedKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/setDottedKey().(res, nil, kparts, v); err != nil {
342 return "", nil, err
343 }
344 default:
345 // fallback to readNode for other kinds (e.g., Key)
346 key, val, err := j.readNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#readNode().(p, childNode)
347 if err != nil {
348 return "", nil, err
349 }
350 if key == "" {
351 return "", nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("missing key in inline table child")
352 }
353 if err := res.SetMapKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMapKey().(key, val); err != nil {
354 return "", nil, err
355 }
356 }
357 }
358
359 return "", res, nil
360 }
361
362 func (j *tomlReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#) readArrayValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#readArrayValue().(p *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Parserscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Parser#, n *unstablescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) {
363 res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().()
364
365 i := n.Childrenscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Node#Children().()
366
367 for i.Nextscip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Iterator#Next().() {
368 childNode := i.Nodescip-go gomod github.com/pelletier/go-toml/v2 v2.4.3 `github.com/pelletier/go-toml/v2/unstable`/Iterator#Node().()
369
370 _, val, err := j.readNodescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlReader#readNode().(p, childNode)
371 if err != nil {
372 return nil, err
373 }
374
375 val.SetMetadataValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#SetMetadataValue().(tomlTableStyleKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleKey., tomlTableStyleArrayscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing/toml`/tomlTableStyleArray.)
376
377 if err := res.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(val); err != nil {
378 return nil, err
379 }
380 }
381
382 return res, nil
383 }