protoutil

package
v0.3.84-rc-f041857 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecompressAndUnmarshall

func DecompressAndUnmarshall[T proto.Message](buf []byte, msg T, decompressor compress.Decompressor) (T, error)

DecompressAndUnmarshall first decompressed the message and then unmarshalls

func MarshallAndCompress

func MarshallAndCompress(msg proto.Message, compressor compress.Compressor) ([]byte, error)

MarshallAndCompress first marshalls the supplied proto message and then compresses it.

func MustDecompressAndUnmarshall

func MustDecompressAndUnmarshall[T proto.Message](buf []byte, msg T, decompressor compress.Decompressor) T

MustDecompressAndUnmarshall first decompressed the message and then unmarshalls. If either of these steps fail then it will panic. The main use case here is for unit tests. Think carefully if you intend to use this elsewhere

func MustMarshall

func MustMarshall(msg proto.Message) []byte

MustMarshall marshalls a proto message and panics if the unmarshall fails. The main use case here is for unit tests. Think carefully if you intend to use this elsewhere

func MustMarshallAndCompress

func MustMarshallAndCompress(msg proto.Message, compressor compress.Compressor) []byte

MustMarshallAndCompress first marshalls the supplied proto message and then compresses it. If either of these steps fail then it will panic. The main use case here is for unit tests. Think carefully if you intend to use this elsewhere

func MustUnmarshall

func MustUnmarshall[T proto.Message](buf []byte, msg T) T

MustUnmarshall unmarshalls a proto message and panics if the unmarshall fails. The main use case here is for unit tests. Think carefully if you intend to use this elsewhere

func Unmarshall

func Unmarshall[T proto.Message](buf []byte, msg T) (T, error)

Unmarshall unmarshalls a proto message in a type-safe way. Hopefully go-generics will one day be powerful enough that we won't need the msg param

Types

This section is empty.

Jump to

Keyboard shortcuts

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