MCPcopy Index your code
hub / github.com/tinylib/msgp / rwMap

Function rwMap

msgp/json.go:98–189  ·  view source on GitHub ↗
(dst jsWriter, src *Reader)

Source from the content-addressed store, hash-verified

96}
97
98func rwMap(dst jsWriter, src *Reader) (n int, err error) {
99 var comma bool
100 var sz uint32
101 var field []byte
102
103 sz, err = src.ReadMapHeader()
104 if err != nil {
105 return
106 }
107
108 if sz == 0 {
109 return dst.WriteString("{}")
110 }
111
112 // This is potentially a recursive call.
113 if done, err := src.recursiveCall(); err != nil {
114 return 0, err
115 } else {
116 defer done()
117 }
118
119 err = dst.WriteByte('{')
120 if err != nil {
121 return
122 }
123 n++
124 var nn int
125 for i := uint32(0); i < sz; i++ {
126 if comma {
127 err = dst.WriteByte(',')
128 if err != nil {
129 return
130 }
131 n++
132 }
133
134 var kt Type
135 kt, err = src.NextType()
136 if err != nil {
137 return
138 }
139 switch kt {
140 case IntType:
141 var i64 int64
142 i64, err = src.ReadInt64()
143 if err != nil {
144 return
145 }
146 src.scratch = strconv.AppendInt(src.scratch[:0], i64, 10)
147 nn, err = rwquoted(dst, src.scratch)
148 case UintType:
149 var u64 uint64
150 u64, err = src.ReadUint64()
151 if err != nil {
152 return
153 }
154 src.scratch = strconv.AppendUint(src.scratch[:0], u64, 10)
155 nn, err = rwquoted(dst, src.scratch)

Callers

nothing calls this directly

Calls 10

rwquotedFunction · 0.85
rwNextFunction · 0.85
ReadMapHeaderMethod · 0.80
recursiveCallMethod · 0.80
WriteByteMethod · 0.80
NextTypeMethod · 0.80
ReadInt64Method · 0.80
ReadUint64Method · 0.80
ReadMapKeyPtrMethod · 0.80
WriteStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…