protowire

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

protowire

import "github.com/cloudwego/dynamicgo/proto/protowire"

Index

func AppendFixed32

func AppendFixed32(b []byte, v uint32) []byte

AppendFixed32 appends v to b as a little-endian uint32.

func AppendFixed64

func AppendFixed64(b []byte, v uint64) []byte

AppendFixed64 appends v to b as a little-endian uint64.

func AppendVarint

func AppendVarint(b []byte, v uint64) []byte

VarintEncode encodes a uint64 value as a varint-encoded byte slice. AppendVarint appends v to b as a varint-encoded uint64.

func ConsumeBytes

func ConsumeBytes(b []byte) (v []byte, n int, all int)

ConsumeBytes parses b as a length-prefixed bytes value, reporting its length. This returns a negative length upon an error (see ParseError).

func ConsumeFixed32

func ConsumeFixed32(b []byte) (v uint32, n int)

ConsumeFixed32 parses b as a little-endian uint32, reporting its length. This returns a negative length upon an error (see ParseError).

func ConsumeFixed64

func ConsumeFixed64(b []byte) (v uint64, n int)

ConsumeFixed64 parses b as a little-endian uint64, reporting its length. This returns a negative length upon an error (see ParseError).

func ConsumeVarint

func ConsumeVarint(b []byte) (v uint64, n int)

ConsumeVarint parses b as a varint-encoded uint64, reporting its length. This returns a negative length upon an error (see ParseError).

func DecodeZigZag

func DecodeZigZag(x uint64) int64

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

func EncodeZigZag(v int64) uint64

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

func SizeVarint(v uint64) int

SizeVarint returns the encoded size of a varint. The size is guaranteed to be within 1 and 10, inclusive.

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

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFixed32

func AppendFixed32(b []byte, v uint32) []byte

AppendFixed32 appends v to b as a little-endian uint32.

func AppendFixed64

func AppendFixed64(b []byte, v uint64) []byte

AppendFixed64 appends v to b as a little-endian uint64.

func AppendVarint

func AppendVarint(b []byte, v uint64) []byte

VarintEncode encodes a uint64 value as a varint-encoded byte slice. AppendVarint appends v to b as a varint-encoded uint64.

func ConsumeBytes

func ConsumeBytes(b []byte) (v []byte, n int, all int)

ConsumeBytes parses b as a length-prefixed bytes value, reporting its length. This returns a negative length upon an error (see ParseError).

func ConsumeFixed32

func ConsumeFixed32(b []byte) (v uint32, n int)

ConsumeFixed32 parses b as a little-endian uint32, reporting its length. This returns a negative length upon an error (see ParseError).

func ConsumeFixed64

func ConsumeFixed64(b []byte) (v uint64, n int)

ConsumeFixed64 parses b as a little-endian uint64, reporting its length. This returns a negative length upon an error (see ParseError).

func ConsumeVarint

func ConsumeVarint(b []byte) (v uint64, n int)

ConsumeVarint parses b as a varint-encoded uint64, reporting its length. This returns a negative length upon an error (see ParseError).

func DecodeZigZag

func DecodeZigZag(x uint64) int64

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

func EncodeZigZag(v int64) uint64

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

func SizeVarint(v uint64) int

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL