messageset
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package messageset encodes and decodes the obsolete MessageSet wire format.
Index¶
- Constants
- func AppendFieldEnd(b []byte) []byte
- func AppendFieldStart(b []byte, num protowire.Number) []byte
- func AppendUnknown(b, unknown []byte) ([]byte, error)
- func ConsumeFieldValue(b []byte, wantLen bool) (typeid protowire.Number, message []byte, n int, err error)
- func IsMessageSet(md protoreflect.MessageDescriptor) bool
- func IsMessageSetExtension(fd protoreflect.FieldDescriptor) bool
- func SizeField(num protowire.Number) int
- func SizeUnknown(unknown []byte) (size int)
- func Unmarshal(b []byte, wantLen bool, fn func(typeID protowire.Number, value []byte) error) error
Constants¶
const (FieldItem =protowire.Number(1)FieldTypeID =protowire.Number(2)FieldMessage =protowire.Number(3))
The MessageSet wire format is equivalent to a message defined as follows,where each Item defines an extension field with a field number of 'type_id'and content of 'message'. MessageSet extensions must be non-repeated messagefields.
message MessageSet {repeated group Item = 1 {required int32 type_id = 2;required string message = 3;}}const ExtensionName = "message_set_extension"ExtensionName is the field name for extensions of MessageSet.
A valid MessageSet extension must be of the form:
message MyMessage {extend proto2.bridge.MessageSet {optional MyMessage message_set_extension = 1234;}...}Variables¶
This section is empty.
Functions¶
funcAppendFieldEnd¶
AppendFieldEnd appends the trailing end group marker for a MessageSet item field.
funcAppendFieldStart¶
AppendFieldStart appends the start of a MessageSet item field containingan extension with the given number. The caller must add the messagesubfield (including the tag).
funcAppendUnknown¶
AppendUnknown appends unknown fields to b in MessageSet format.
For historic reasons, unresolved items in a MessageSet are stored in amessage's unknown fields section in non-MessageSet format. That is, anunknown item with typeID T and value V appears in the unknown fields asa field with number T and value V.
This function converts the unknown fields back into MessageSet form.
funcConsumeFieldValue¶
func ConsumeFieldValue(b []byte, wantLenbool) (typeidprotowire.Number, message []byte, nint, errerror)
ConsumeFieldValue parses b as a MessageSet item field value until and includingthe trailing end group marker. It assumes the start group tag has already been parsed.It returns the contents of the type_id and message subfields and the totalitem length.
If wantLen is true, the returned message value includes the length prefix.
funcIsMessageSet¶
func IsMessageSet(mdprotoreflect.MessageDescriptor)bool
IsMessageSet returns whether the message uses the MessageSet wire format.
funcIsMessageSetExtension¶
func IsMessageSetExtension(fdprotoreflect.FieldDescriptor)bool
IsMessageSetExtension reports this field properly extends a MessageSet.
funcSizeField¶
SizeField returns the size of a MessageSet item field containing an extensionwith the given field number, not counting the contents of the message subfield.
funcSizeUnknown¶
SizeUnknown returns the size of an unknown fields section in MessageSet format.
See AppendUnknown.
Types¶
This section is empty.