MCPcopy
hub / github.com/NVIDIA/aistore / MarshalJSON

Method MarshalJSON

downloader/api.go:97–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95}
96
97func (db DlBody) MarshalJSON() ([]byte, error) {
98 b, err := db.RawMessage.MarshalJSON()
99 if err != nil {
100 return nil, err
101 }
102 debug.Assert(b[0] == '{' && b[len(b)-1] == '}')
103 s := fmt.Sprintf(`{"type": %q, %s}`, db.Type, string(b[1:len(b)-1]))
104 return []byte(s), nil
105}
106
107func (db *DlBody) UnmarshalJSON(b []byte) error {
108 db.Type = DlType(jsoniter.Get(b, "type").ToString())

Callers

nothing calls this directly

Calls 1

AssertFunction · 0.92

Tested by

no test coverage detected