MCPcopy
hub / github.com/segmentio/kafka-go / decodeFuncOf

Function decodeFuncOf

protocol/decode.go:342–371  ·  view source on GitHub ↗
(typ reflect.Type, version int16, flexible bool, tag structTag)

Source from the content-addressed store, hash-verified

340)
341
342func decodeFuncOf(typ reflect.Type, version int16, flexible bool, tag structTag) decodeFunc {
343 if reflect.PtrTo(typ).Implements(readerFrom) {
344 return readerDecodeFuncOf(typ)
345 }
346 switch typ.Kind() {
347 case reflect.Bool:
348 return (*decoder).decodeBool
349 case reflect.Int8:
350 return (*decoder).decodeInt8
351 case reflect.Int16:
352 return (*decoder).decodeInt16
353 case reflect.Int32:
354 return (*decoder).decodeInt32
355 case reflect.Int64:
356 return (*decoder).decodeInt64
357 case reflect.Float64:
358 return (*decoder).decodeFloat64
359 case reflect.String:
360 return stringDecodeFuncOf(flexible, tag)
361 case reflect.Struct:
362 return structDecodeFuncOf(typ, version, flexible)
363 case reflect.Slice:
364 if typ.Elem().Kind() == reflect.Uint8 { // []byte
365 return bytesDecodeFuncOf(flexible, tag)
366 }
367 return arrayDecodeFuncOf(typ, version, flexible, tag)
368 default:
369 panic("unsupported type: " + typ.String())
370 }
371}
372
373func stringDecodeFuncOf(flexible bool, tag structTag) decodeFunc {
374 if flexible {

Callers 4

makeTypesFunction · 0.85
structDecodeFuncOfFunction · 0.85
arrayDecodeFuncOfFunction · 0.85
UnmarshalFunction · 0.85

Calls 6

readerDecodeFuncOfFunction · 0.85
stringDecodeFuncOfFunction · 0.85
structDecodeFuncOfFunction · 0.85
bytesDecodeFuncOfFunction · 0.85
arrayDecodeFuncOfFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected