Append Tag
(num proto.FieldNumber, typ proto.WireType)
| 135 | |
| 136 | // Append Tag |
| 137 | func (p *BinaryProtocol) AppendTag(num proto.FieldNumber, typ proto.WireType) error { |
| 138 | tag := uint64(num)<<3 | uint64(typ&7) |
| 139 | if num > proto.MaxValidNumber || num < proto.MinValidNumber { |
| 140 | return errInvalidFieldNumber |
| 141 | } |
| 142 | p.Buf = protowire.BinaryEncoder{}.EncodeUint64(p.Buf, tag) |
| 143 | return nil |
| 144 | } |
| 145 | |
| 146 | // Append Tag With FieldDescriptor by kind, you must use kind to write tag, because the typedesc when list has no tag |
| 147 | func (p *BinaryProtocol) AppendTagByKind(number proto.FieldNumber, kind proto.ProtoKind) error { |