(typ reflect.Type, version int16, flexible bool, tag structTag)
| 340 | ) |
| 341 | |
| 342 | func 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 | |
| 373 | func stringDecodeFuncOf(flexible bool, tag structTag) decodeFunc { |
| 374 | if flexible { |
no test coverage detected