()
| 776 | } |
| 777 | |
| 778 | func (s *BaseElem) BaseType() string { |
| 779 | switch s.Value { |
| 780 | case IDENT: |
| 781 | return s.alias |
| 782 | |
| 783 | // exceptions to the naming/capitalization |
| 784 | // rule: |
| 785 | case Intf: |
| 786 | return "interface{}" |
| 787 | case Bytes: |
| 788 | return "[]byte" |
| 789 | case Time: |
| 790 | return "time.Time" |
| 791 | case Duration: |
| 792 | return "time.Duration" |
| 793 | case JsonNumber: |
| 794 | return "json.Number" |
| 795 | case AInt64: |
| 796 | return "atomic.Int64" |
| 797 | case AUint64: |
| 798 | return "atomic.Uint64" |
| 799 | case AInt32: |
| 800 | return "atomic.Int32" |
| 801 | case AUint32: |
| 802 | return "atomic.Uint32" |
| 803 | case ABool: |
| 804 | return "atomic.Bool" |
| 805 | |
| 806 | case Ext: |
| 807 | return "msgp.Extension" |
| 808 | |
| 809 | // everything else is base.String() with |
| 810 | // the first letter as lowercase |
| 811 | default: |
| 812 | return strings.ToLower(s.BaseName()) |
| 813 | } |
| 814 | } |
| 815 | |
| 816 | func (s *BaseElem) Needsref(b bool) { |
| 817 | s.needsref = b |