MCPcopy Create free account
hub / github.com/ProspectOne/perfops-cli / MarshalJSON

Method MarshalJSON

perfops/run.go:167–179  ·  view source on GitHub ↗

MarshalJSON returns the JSON encoding of NodeIDs, e.g., a comma separated list.

()

Source from the content-addressed store, hash-verified

165// MarshalJSON returns the JSON encoding of NodeIDs, e.g., a comma
166// separated list.
167func (n NodeIDs) MarshalJSON() ([]byte, error) {
168 var b bytes.Buffer
169 l := len(n) - 1
170 b.WriteRune('"')
171 for i, id := range n {
172 b.WriteString(strconv.Itoa(id))
173 if i < l {
174 b.WriteRune(',')
175 }
176 }
177 b.WriteRune('"')
178 return b.Bytes(), nil
179}
180
181// UnmarshalJSON parses the JSON-encoded data.
182func (n *NodeIDs) UnmarshalJSON(data []byte) error {

Callers 1

TestNodeIDsMarshalJSONFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestNodeIDsMarshalJSONFunction · 0.64