protohelper

package
v0.0.0-...-da76002 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)

Functions

func Bool2Int

func Bool2Int(b bool) int

func CalcListLength

func CalcListLength(data []byte) (int, int)

func ConsumeFixed32

func ConsumeFixed32[T int32 | uint32 | float32](data []byte) (T, int)

func ConsumeFixed64

func ConsumeFixed64[T int64 | uint64 | float64](data []byte) (T, int)

func ConsumeMessage

func ConsumeMessage(data []byte, msg proto.Message) (int, error)

func ConsumeVarint

func ConsumeVarint[T int32 | uint32 | int64 | uint64 | float32 | float64](data []byte) (T, int)

func EqualBytes

func EqualBytes(b1, b2 []byte) bool

func EqualBytesMap

func EqualBytesMap[K comparable](s1, s2 map[K][]byte) bool

func EqualBytesSlice

func EqualBytesSlice(s1, s2 [][]byte) bool

func EqualMap

func EqualMap[K comparable, V comparable](s1, s2 map[K]V) bool

func EqualProtoMap

func EqualProtoMap[K comparable, V proto.Message](s1, s2 map[K]V) bool

func EqualProtoSlice

func EqualProtoSlice[V proto.Message](s1, s2 []V) bool

func EqualSlice

func EqualSlice[T comparable](s1, s2 []T) bool

func FieldMessageName

func FieldMessageName(gen *protogen.Plugin, file *protogen.File, field *protogen.Field) string

func GoTypeOfField

func GoTypeOfField(field protoreflect.FieldDescriptor) string

func KindToType

func KindToType(kind protoreflect.Kind) protowire.Type

func MessageTypesVarName

func MessageTypesVarName(f *protogen.File) string

func SizeVarintSlice

func SizeVarintSlice[T int32 | uint32 | int64 | uint64](arr []T) int

func SizeZigZagSlice

func SizeZigZagSlice[T int32 | uint32 | int64 | uint64](arr []T) int

func Skip

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

Types

type VarintType

type VarintType interface {
	int32 | uint32 | int64 | uint64 | bool
}

Jump to

Keyboard shortcuts

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