MCPcopy Create free account
hub / github.com/cloudwego/dynamicgo / AppendTag

Method AppendTag

proto/binary/binary.go:137–144  ·  view source on GitHub ↗

Append Tag

(num proto.FieldNumber, typ proto.WireType)

Source from the content-addressed store, hash-verified

135
136// Append Tag
137func (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
147func (p *BinaryProtocol) AppendTagByKind(number proto.FieldNumber, kind proto.ProtoKind) error {

Callers 15

AppendTagByKindMethod · 0.95
WriteListMethod · 0.95
WriteMapMethod · 0.95
WriteMessageFieldsMethod · 0.95
marshalToFunction · 0.80
marshalMethod · 0.80
TestTagFunction · 0.80
OnObjectBeginMethod · 0.80
OnObjectKeyMethod · 0.80
OnArrayBeginMethod · 0.80

Calls 1

EncodeUint64Method · 0.80