Documentation
¶
Index ¶
- func DecodeVarint(buffer []byte) (uint64, int)
- func EncodeFixed32(value uint32) []byte
- func EncodeFixed64(value uint64) []byte
- func EncodeVarint(value uint64) []byte
- func ParseFixed32(buffer []byte) (uint32, int, error)
- func ParseFixed64(buffer []byte) (uint64, int, error)
- func ParseLengthPrefixed(buffer []byte) (uint64, int, error)
- type Field
- func Bytes(fieldNum uint32, value []byte) *Field
- func Embed(fieldNum uint32, value ...*Field) *Field
- func Fixed32(fieldNum uint32, value uint32) *Field
- func Fixed64(fieldNum uint32, value uint64) *Field
- func String(fieldNum uint32, value string) *Field
- func Varint(fieldNum uint32, value uint64) *Field
- type Iterator
- type Message
- type Tag
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeVarint ¶ added in v1.5.2
DecodeVarint reads a varint from the buffer and returns the decoded uint64 and the number of bytes read. A negative number of bytes indicates an overflow. A zero indicates an unterminated varint.
func EncodeFixed32 ¶ added in v1.5.2
EncodeFixed32 encodes a uint32 into 4 bytes (little-endian).
func EncodeFixed64 ¶ added in v1.5.2
EncodeFixed64 encodes a uint64 into 8 bytes (little-endian).
func EncodeVarint ¶ added in v1.5.2
EncodeVarint encodes a uint64 into varint bytes.
func ParseFixed32 ¶ added in v1.5.2
ParseFixed32 parses a 32-bit little-endian integer from the buffer.
func ParseFixed64 ¶ added in v1.5.2
ParseFixed64 parses a 64-bit little-endian integer from the buffer.
Types ¶
type Field ¶ added in v1.4.5
Field represents a single, decoded field in a protobuf message.
func Embed ¶ added in v1.5.6
Embed creates a new embedded message field from the provided sub-fields.
type Iterator ¶ added in v1.5.2
type Iterator struct {
// contains filtered or unexported fields
}
Iterator provides a stateful, memory-efficient way to loop over all occurrences of a specific field number within a message.
type Message ¶
type Message []*Field
Message is a named type for a slice of field pointers, representing a parsed protobuf message.
func (Message) Encode ¶ added in v1.5.2
Encode serializes the message into the protobuf wire format.
func (Message) Field ¶ added in v1.5.2
Field finds and returns the first field matching the given field number. The boolean return value is false if no matching field is found.