protohelpers

package
v0.0.0-...-ecabb92 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 16 Imported by: 8

Documentation

Index

Constants

View Source
const FileTypeInfer = "infer"

Variables

View Source
var (
	ErrUser          = fmt.Errorf("user error")
	ErrTemplateParse = errors.Wrap(ErrUser, "template parse error")
	ErrTemplateExec  = errors.Wrap(ErrUser, "template exec error")
)

Functions

func CloneList

func CloneList[T VTMessageTyped[T]](list []T) []T

func Equal

func Equal(m1, m2 proto.Message) bool

faster version of proto.Equal that doesn't involve allocations

func GzipBytes

func GzipBytes(b []byte) ([]byte, error)

func MarshalBytesAndJson

func MarshalBytesAndJson(msg proto.Message) ([]byte, []byte, error)

func MarshalBytesGzipped

func MarshalBytesGzipped(msg proto.Message) ([]byte, error)

func MarshalBytesZstd

func MarshalBytesZstd(msg proto.Message) ([]byte, error)

func ProtoListEqual

func ProtoListEqual[T proto.Message](a, b []T) bool

func TemplateExecute

func TemplateExecute(msg proto.Message, templateData map[string]interface{}) error

func TransformStrings

func TransformStrings(msg proto.Message, transform func(string) (string, error)) error

func UngzipBytes

func UngzipBytes(b []byte) (uncompressed []byte, finalErr error)

func Unmarshal

func Unmarshal(fileType, fileName string, bytes []byte, message proto.Message, discardUnknown bool) error

func UnmarshalGzippedProto

func UnmarshalGzippedProto(b []byte, msg proto.Message) error

func UnmarshalZstdProto

func UnmarshalZstdProto(b []byte, msg proto.Message) error

func ZstdCompressBytes

func ZstdCompressBytes(b []byte) ([]byte, error)

func ZstdUncompressBytes

func ZstdUncompressBytes(b []byte) (uncompressed []byte, finalErr error)

Types

type ProtoHash

type ProtoHash string

func MustHashProto

func MustHashProto(msg proto.Message) ProtoHash

type VTMessage

type VTMessage interface {
	proto.Message
	StableEqualMessageVT(proto.Message) bool
	EqualMessageVT(proto.Message) bool
}

type VTMessageTyped

type VTMessageTyped[T proto.Message] interface {
	VTMessage
	CloneVT() T
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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