pb

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeProtobufToJSON

func DecodeProtobufToJSON(m *dynamic.Message, data []byte) ([]byte, error)

DecodeProtobufToJSON is a wrapper for decoding/unmarshalling []byte of protobuf into a dynamic.Message and then marshalling that into JSON.

func FindMessageDescriptor

func FindMessageDescriptor(protobufDirs []string, protobufRootMessage string) (*desc.MessageDescriptor, error)

FindMessageDescriptor is a wrapper that will:

  1. Recursively find all .proto files in a directory
  2. Attempt to read and parse all files as proto FileDescriptors
  3. Attempt to find the specified "protobufRootMessage" type in the parsed FileDescriptors; if found, return the related MessageDescriptor

With the found MessageDescriptor, we are able to generate new dynamic messages via dynamic.NewMessage(..).

Types

This section is empty.

Jump to

Keyboard shortcuts

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