| 667 | } |
| 668 | |
| 669 | func (e *Encoder) tagFor(typ reflect.Type) int8 { |
| 670 | switch typ.Kind() { |
| 671 | case reflect.Uint8, reflect.Int8, reflect.Bool: |
| 672 | return Byte |
| 673 | case reflect.Uint16, reflect.Int16: |
| 674 | return Short |
| 675 | case reflect.Uint32, reflect.Int32: |
| 676 | return Int |
| 677 | case reflect.Uint64, reflect.Int64: |
| 678 | return Long |
| 679 | case reflect.Float32: |
| 680 | return Float |
| 681 | case reflect.Float64: |
| 682 | return Double |
| 683 | case reflect.Struct, reflect.Map: |
| 684 | return Compound |
| 685 | case reflect.String: |
| 686 | return String |
| 687 | case reflect.Slice, reflect.Array: |
| 688 | { |
| 689 | switch typ.Elem().Kind() { |
| 690 | case reflect.Uint8, reflect.Int8: |
| 691 | return ByteArray |
| 692 | case reflect.Uint32, reflect.Int32: |
| 693 | return IntArray |
| 694 | case reflect.Uint64, reflect.Int64: |
| 695 | return LongArray |
| 696 | default: |
| 697 | return List |
| 698 | } |
| 699 | } |
| 700 | default: |
| 701 | return 0 |
| 702 | } |
| 703 | } |