Documentation ¶
Index ¶
- func DecodeProtobufToJSON(envelope, payload *dynamic.Message, data []byte, payloadFieldID int32) ([]byte, error)
- func FindMessageDescriptor(protobufDirs []string, protobufRootMessage string) (*desc.MessageDescriptor, error)
- func FindMessageDescriptorInFDS(fds []*desc.FileDescriptor, rootMessage string) (*desc.MessageDescriptor, error)
- type MDType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeProtobufToJSON ¶
func DecodeProtobufToJSON(envelope, payload *dynamic.Message, data []byte, payloadFieldID int32) ([]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:
- Recursively find all .proto files in a directory
- Attempt to read and parse all files as proto FileDescriptors
- 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(..).
func FindMessageDescriptorInFDS ¶ added in v1.0.0
func FindMessageDescriptorInFDS(fds []*desc.FileDescriptor, rootMessage string) (*desc.MessageDescriptor, error)
Types ¶
Click to show internal directories.
Click to hide internal directories.