MCPcopy
hub / github.com/vmihailenco/msgpack / Decode

Method Decode

decode.go:194–312  ·  view source on GitHub ↗

nolint:gocyclo

(v interface{})

Source from the content-addressed store, hash-verified

192
193//nolint:gocyclo
194func (d *Decoder) Decode(v interface{}) error {
195 var err error
196 switch v := v.(type) {
197 case *string:
198 if v != nil {
199 *v, err = d.DecodeString()
200 return err
201 }
202 case *[]byte:
203 if v != nil {
204 return d.decodeBytesPtr(v)
205 }
206 case *int:
207 if v != nil {
208 *v, err = d.DecodeInt()
209 return err
210 }
211 case *int8:
212 if v != nil {
213 *v, err = d.DecodeInt8()
214 return err
215 }
216 case *int16:
217 if v != nil {
218 *v, err = d.DecodeInt16()
219 return err
220 }
221 case *int32:
222 if v != nil {
223 *v, err = d.DecodeInt32()
224 return err
225 }
226 case *int64:
227 if v != nil {
228 *v, err = d.DecodeInt64()
229 return err
230 }
231 case *uint:
232 if v != nil {
233 *v, err = d.DecodeUint()
234 return err
235 }
236 case *uint8:
237 if v != nil {
238 *v, err = d.DecodeUint8()
239 return err
240 }
241 case *uint16:
242 if v != nil {
243 *v, err = d.DecodeUint16()
244 return err
245 }
246 case *uint32:
247 if v != nil {
248 *v, err = d.DecodeUint32()
249 return err
250 }
251 case *uint64:

Callers 15

TestUseJsonTagFunction · 0.95
TestUseCustomTagFunction · 0.95
TestTypesFunction · 0.95
TestSetOmitEmptyFunction · 0.95
TestInternedStringTagFunction · 0.95
benchmarkEncodeDecodeFunction · 0.95
DecodeMultiMethod · 0.95
DecodeMsgpackMethod · 0.80
TestDecodeNilMethod · 0.80
TestTimeMethod · 0.80
TestLargeBytesMethod · 0.80

Calls 15

DecodeStringMethod · 0.95
decodeBytesPtrMethod · 0.95
DecodeIntMethod · 0.95
DecodeInt8Method · 0.95
DecodeInt16Method · 0.95
DecodeInt32Method · 0.95
DecodeInt64Method · 0.95
DecodeUintMethod · 0.95
DecodeUint8Method · 0.95
DecodeUint16Method · 0.95
DecodeUint32Method · 0.95
DecodeUint64Method · 0.95

Tested by 15

TestUseJsonTagFunction · 0.76
TestUseCustomTagFunction · 0.76
TestTypesFunction · 0.76
TestSetOmitEmptyFunction · 0.76
TestInternedStringTagFunction · 0.76
benchmarkEncodeDecodeFunction · 0.76
DecodeMsgpackMethod · 0.64
TestDecodeNilMethod · 0.64
TestTimeMethod · 0.64
TestLargeBytesMethod · 0.64
TestLargeStringMethod · 0.64