Documentation ¶
Index ¶
- func AppendFixed32(b []byte, v uint32) []byte
- func AppendFixed64(b []byte, v uint64) []byte
- func AppendVarint(b []byte, v uint64) []byte
- func ConsumeBytes(b []byte) (v []byte, n int, all int)
- func ConsumeFixed32(b []byte) (v uint32, n int)
- func ConsumeFixed64(b []byte) (v uint64, n int)
- func ConsumeVarint(b []byte) (v uint64, n int)
- func DecodeZigZag(x uint64) int64
- func EncodeZigZag(v int64) uint64
- func SizeFixed32() int
- func SizeFixed64() int
- func SizeVarint(v uint64) int
- type BinaryDecoder
- func (BinaryDecoder) DecodeBool(b []byte) (bool, int)
- func (BinaryDecoder) DecodeByte(b []byte) byte
- func (BinaryDecoder) DecodeBytes(b []byte) ([]byte, int, int)
- func (BinaryDecoder) DecodeDouble(b []byte) (float64, int)
- func (BinaryDecoder) DecodeFixed32(b []byte) (uint32, int)
- func (BinaryDecoder) DecodeFixed64(b []byte) (uint64, int)
- func (BinaryDecoder) DecodeFloat32(b []byte) (float32, int)
- func (BinaryDecoder) DecodeInt32(b []byte) (int32, int)
- func (BinaryDecoder) DecodeInt64(b []byte) (int64, int)
- func (BinaryDecoder) DecodeSfixed32(b []byte) (int32, int)
- func (BinaryDecoder) DecodeSfixed64(b []byte) (int64, int)
- func (BinaryDecoder) DecodeSint32(b []byte) (int32, int)
- func (BinaryDecoder) DecodeSint64(b []byte) (int64, int)
- func (BinaryDecoder) DecodeString(b []byte) (string, int, int)
- func (BinaryDecoder) DecodeUint32(b []byte) (uint32, int)
- func (BinaryDecoder) DecodeUint64(b []byte) (uint64, int)
- type BinaryEncoder
- func (BinaryEncoder) EncodeBool(b []byte, v bool) []byte
- func (BinaryEncoder) EncodeByte(b []byte, v byte) []byte
- func (BinaryEncoder) EncodeBytes(b []byte, v []byte) []byte
- func (BinaryEncoder) EncodeDouble(b []byte, v float64) []byte
- func (BinaryEncoder) EncodeEnum(b []byte, v int32) []byte
- func (BinaryEncoder) EncodeFixed32(b []byte, v uint32) []byte
- func (BinaryEncoder) EncodeFixed64(b []byte, v uint64) []byte
- func (BinaryEncoder) EncodeFloat32(b []byte, v float32) []byte
- func (BinaryEncoder) EncodeInt32(b []byte, v int32) []byte
- func (BinaryEncoder) EncodeInt64(b []byte, v int64) []byte
- func (BinaryEncoder) EncodeSfixed32(b []byte, v int32) []byte
- func (BinaryEncoder) EncodeSfixed64(b []byte, v int64) []byte
- func (BinaryEncoder) EncodeSint32(b []byte, v int32) []byte
- func (BinaryEncoder) EncodeSint64(b []byte, v int64) []byte
- func (BinaryEncoder) EncodeString(b []byte, v string) []byte
- func (BinaryEncoder) EncodeUint32(b []byte, v uint32) []byte
- func (BinaryEncoder) EncodeUint64(b []byte, v uint64) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFixed32 ¶
AppendFixed32 appends v to b as a little-endian uint32.
func AppendFixed64 ¶
AppendFixed64 appends v to b as a little-endian uint64.
func AppendVarint ¶
VarintEncode encodes a uint64 value as a varint-encoded byte slice. AppendVarint appends v to b as a varint-encoded uint64.
func ConsumeBytes ¶
ConsumeBytes parses b as a length-prefixed bytes value, reporting its length. This returns a negative length upon an error (see ParseError).
func ConsumeFixed32 ¶
ConsumeFixed32 parses b as a little-endian uint32, reporting its length. This returns a negative length upon an error (see ParseError).
func ConsumeFixed64 ¶
ConsumeFixed64 parses b as a little-endian uint64, reporting its length. This returns a negative length upon an error (see ParseError).
func ConsumeVarint ¶
ConsumeVarint parses b as a varint-encoded uint64, reporting its length. This returns a negative length upon an error (see ParseError).
func DecodeZigZag ¶
DecodeZigZag decodes a zig-zag-encoded uint64 as an int64.
Input: {…, 5, 3, 1, 0, 2, 4, 6, …} Output: {…, -3, -2, -1, 0, +1, +2, +3, …}
func EncodeZigZag ¶
EncodeZigZag encodes an int64 as a zig-zag-encoded uint64.
Input: {…, -3, -2, -1, 0, +1, +2, +3, …} Output: {…, 5, 3, 1, 0, 2, 4, 6, …}
func SizeFixed32 ¶
func SizeFixed32() int
SizeFixed32 returns the encoded size of a fixed32; which is always 4.
func SizeFixed64 ¶
func SizeFixed64() int
SizeFixed64 returns the encoded size of a fixed64; which is always 8.
func SizeVarint ¶
SizeVarint returns the encoded size of a varint. The size is guaranteed to be within 1 and 10, inclusive.
Types ¶
type BinaryDecoder ¶
type BinaryDecoder struct{}
func (BinaryDecoder) DecodeBool ¶
func (BinaryDecoder) DecodeBool(b []byte) (bool, int)
func (BinaryDecoder) DecodeByte ¶
func (BinaryDecoder) DecodeByte(b []byte) byte
func (BinaryDecoder) DecodeBytes ¶
func (BinaryDecoder) DecodeBytes(b []byte) ([]byte, int, int)
func (BinaryDecoder) DecodeDouble ¶
func (BinaryDecoder) DecodeDouble(b []byte) (float64, int)
func (BinaryDecoder) DecodeFixed32 ¶
func (BinaryDecoder) DecodeFixed32(b []byte) (uint32, int)
func (BinaryDecoder) DecodeFixed64 ¶
func (BinaryDecoder) DecodeFixed64(b []byte) (uint64, int)
func (BinaryDecoder) DecodeFloat32 ¶
func (BinaryDecoder) DecodeFloat32(b []byte) (float32, int)
func (BinaryDecoder) DecodeInt32 ¶
func (BinaryDecoder) DecodeInt32(b []byte) (int32, int)
func (BinaryDecoder) DecodeInt64 ¶
func (BinaryDecoder) DecodeInt64(b []byte) (int64, int)
func (BinaryDecoder) DecodeSfixed32 ¶
func (BinaryDecoder) DecodeSfixed32(b []byte) (int32, int)
func (BinaryDecoder) DecodeSfixed64 ¶
func (BinaryDecoder) DecodeSfixed64(b []byte) (int64, int)
func (BinaryDecoder) DecodeSint32 ¶
func (BinaryDecoder) DecodeSint32(b []byte) (int32, int)
func (BinaryDecoder) DecodeSint64 ¶
func (BinaryDecoder) DecodeSint64(b []byte) (int64, int)
func (BinaryDecoder) DecodeString ¶
func (BinaryDecoder) DecodeString(b []byte) (string, int, int)
func (BinaryDecoder) DecodeUint32 ¶
func (BinaryDecoder) DecodeUint32(b []byte) (uint32, int)
func (BinaryDecoder) DecodeUint64 ¶
func (BinaryDecoder) DecodeUint64(b []byte) (uint64, int)
type BinaryEncoder ¶
type BinaryEncoder struct{}
func (BinaryEncoder) EncodeBool ¶
func (BinaryEncoder) EncodeBool(b []byte, v bool) []byte
encode each proto kind into bytes
func (BinaryEncoder) EncodeByte ¶
func (BinaryEncoder) EncodeByte(b []byte, v byte) []byte
func (BinaryEncoder) EncodeBytes ¶
func (BinaryEncoder) EncodeBytes(b []byte, v []byte) []byte
func (BinaryEncoder) EncodeDouble ¶
func (BinaryEncoder) EncodeDouble(b []byte, v float64) []byte
func (BinaryEncoder) EncodeEnum ¶
func (BinaryEncoder) EncodeEnum(b []byte, v int32) []byte
func (BinaryEncoder) EncodeFixed32 ¶
func (BinaryEncoder) EncodeFixed32(b []byte, v uint32) []byte
func (BinaryEncoder) EncodeFixed64 ¶
func (BinaryEncoder) EncodeFixed64(b []byte, v uint64) []byte
func (BinaryEncoder) EncodeFloat32 ¶
func (BinaryEncoder) EncodeFloat32(b []byte, v float32) []byte
func (BinaryEncoder) EncodeInt32 ¶
func (BinaryEncoder) EncodeInt32(b []byte, v int32) []byte
func (BinaryEncoder) EncodeInt64 ¶
func (BinaryEncoder) EncodeInt64(b []byte, v int64) []byte
func (BinaryEncoder) EncodeSfixed32 ¶
func (BinaryEncoder) EncodeSfixed32(b []byte, v int32) []byte
func (BinaryEncoder) EncodeSfixed64 ¶
func (BinaryEncoder) EncodeSfixed64(b []byte, v int64) []byte
func (BinaryEncoder) EncodeSint32 ¶
func (BinaryEncoder) EncodeSint32(b []byte, v int32) []byte
func (BinaryEncoder) EncodeSint64 ¶
func (BinaryEncoder) EncodeSint64(b []byte, v int64) []byte
func (BinaryEncoder) EncodeString ¶
func (BinaryEncoder) EncodeString(b []byte, v string) []byte
func (BinaryEncoder) EncodeUint32 ¶
func (BinaryEncoder) EncodeUint32(b []byte, v uint32) []byte
func (BinaryEncoder) EncodeUint64 ¶
func (BinaryEncoder) EncodeUint64(b []byte, v uint64) []byte