Documentation
¶
Index ¶
- Constants
- func AssertFieldType(num, got, exp int)
- func CheckFieldType(num, got, exp int) string
- func EncodeTag(num, typ uint64) uint64
- func PutUvarint(buf []byte, off int, x uint64) int
- func ReadSizeLEN(b []byte) (int, int, string)
- func ReadTag(b []byte) (int, int, int, string)
- func ReadUint32(b []byte) (uint32, int, string)
- func SizeLEN(ln int) int
- func SizeTag(num uint64) int
- func SizeVarint(x uint64) int
- func StringifyFieldType(typ int) string
Constants ¶
const ( FieldTypeVARINT = iota FieldTypeI64 FieldTypeLEN FieldTypeSGROUP FieldTypeEGROUP FieldTypeI32 )
All possible field types declared in https://protobuf.dev/programming-guides/encoding/#structure.
const MaxFieldNumber = 1<<29 - 1
MaxFieldNumber is a maximum field number according to https://protobuf.dev/programming-guides/proto3/#assigning.
Variables ¶
This section is empty.
Functions ¶
func AssertFieldType ¶
func AssertFieldType(num, got, exp int)
AssertFieldType checks whether field with given number has expected type. If not, AssertFieldType panics.
func CheckFieldType ¶
CheckFieldType checks whether field with given number has expected type and returns non-empty exception if not.
func PutUvarint ¶
PutUvarint encodes x into buf with given offset and returns the number of bytes written.
func ReadSizeLEN ¶
ReadSizeLEN reads length of nested FieldTypeLEN field from b. Returns resulting length, number of bytes read and exception.
func ReadTag ¶
ReadTag reads tag of protobuf field from b. Returns field number, type, number of bytes read and exception.
func ReadUint32 ¶
ReadUint32 reads protobuf field of uint32 type. Returns field value, number of bytes read and exception.
func StringifyFieldType ¶
StringifyFieldType stringifies given field type.
Types ¶
This section is empty.