protohelpers

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package protohelpers provides helper functions for encoding and decoding protobuf messages. The spec can be found at https://protobuf.dev/programming-guides/encoding/.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidLength is returned when decoding a negative length.
	ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling")
	// ErrIntOverflow is returned when decoding a varint representation of an integer that overflows 64 bits.
	ErrIntOverflow = fmt.Errorf("proto: integer overflow")
	// ErrUnexpectedEndOfGroup is returned when decoding a group end without a corresponding group start.
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)

Functions

func EncodeVarint

func EncodeVarint(dAtA []byte, offset int, v uint64) int

EncodeVarint encodes a uint64 into a varint-encoded byte slice and returns the offset of the encoded value. The provided offset is the offset after the last byte of the encoded value.

func SizeOfVarint

func SizeOfVarint(x uint64) (n int)

SizeOfVarint returns the size of the varint-encoded value.

func SizeOfZigzag

func SizeOfZigzag(x uint64) (n int)

SizeOfZigzag returns the size of the zigzag-encoded value.

func Skip

func Skip(dAtA []byte) (n int, err error)

Skip the first record of the byte slice and return the offset of the next record.

Types

This section is empty.

Jump to

Keyboard shortcuts

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