MCPcopy
hub / github.com/tinylib/msgp / rwMapBytes

Function rwMapBytes

msgp/json_bytes.go:110–144  ·  view source on GitHub ↗
(w jsWriter, msg []byte, scratch []byte, depth int)

Source from the content-addressed store, hash-verified

108}
109
110func rwMapBytes(w jsWriter, msg []byte, scratch []byte, depth int) ([]byte, []byte, error) {
111 if depth >= recursionLimit {
112 return msg, scratch, ErrRecursion
113 }
114 sz, msg, err := ReadMapHeaderBytes(msg)
115 if err != nil {
116 return msg, scratch, err
117 }
118 err = w.WriteByte('{')
119 if err != nil {
120 return msg, scratch, err
121 }
122 for i := range sz {
123 if i != 0 {
124 err = w.WriteByte(',')
125 if err != nil {
126 return msg, scratch, err
127 }
128 }
129 msg, scratch, err = rwMapKeyBytes(w, msg, scratch, depth)
130 if err != nil {
131 return msg, scratch, err
132 }
133 err = w.WriteByte(':')
134 if err != nil {
135 return msg, scratch, err
136 }
137 msg, scratch, err = writeNext(w, msg, scratch, depth+1)
138 if err != nil {
139 return msg, scratch, err
140 }
141 }
142 err = w.WriteByte('}')
143 return msg, scratch, err
144}
145
146func rwMapKeyBytes(w jsWriter, msg []byte, scratch []byte, depth int) ([]byte, []byte, error) {
147 if len(msg) < 1 {

Callers

nothing calls this directly

Calls 4

ReadMapHeaderBytesFunction · 0.85
rwMapKeyBytesFunction · 0.85
writeNextFunction · 0.85
WriteByteMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…