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

Function rwMapKeyBytes

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

Source from the content-addressed store, hash-verified

144}
145
146func rwMapKeyBytes(w jsWriter, msg []byte, scratch []byte, depth int) ([]byte, []byte, error) {
147 if len(msg) < 1 {
148 return msg, scratch, ErrShortBytes
149 }
150 switch getType(msg[0]) {
151 case IntType:
152 i, msg, err := ReadInt64Bytes(msg)
153 if err != nil {
154 return msg, scratch, err
155 }
156 scratch = strconv.AppendInt(scratch[:0], i, 10)
157 _, err = rwquoted(w, scratch)
158 return msg, scratch, err
159 case UintType:
160 u, msg, err := ReadUint64Bytes(msg)
161 if err != nil {
162 return msg, scratch, err
163 }
164 scratch = strconv.AppendUint(scratch[:0], u, 10)
165 _, err = rwquoted(w, scratch)
166 return msg, scratch, err
167 }
168 msg, scratch, err := rwStringBytes(w, msg, scratch, depth)
169 if err != nil {
170 if tperr, ok := err.(TypeError); ok && tperr.Encoded == BinType {
171 return rwBytesBytes(w, msg, scratch, depth)
172 }
173 }
174 return msg, scratch, err
175}
176
177func rwStringBytes(w jsWriter, msg []byte, scratch []byte, depth int) ([]byte, []byte, error) {
178 str, msg, err := ReadStringZC(msg)

Callers 1

rwMapBytesFunction · 0.85

Calls 6

getTypeFunction · 0.85
ReadInt64BytesFunction · 0.85
rwquotedFunction · 0.85
ReadUint64BytesFunction · 0.85
rwStringBytesFunction · 0.85
rwBytesBytesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…