Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Collect ¶
func Collect(importPaths, servicePaths []string) ([]*desc.FileDescriptor, error)
Collect takes import paths and service paths, walks all of the service paths and then parses the protos and returns all related file descriptors
func Construct ¶
Construct takes a message descriptor and a message, as JSON and returns it as a message, or an error if there's issues marshalling
func NormalizeMessageName ¶
Trims starting "." because message names from the input types come in with a "." prepended
Types ¶
type Collector ¶
type Collector struct { // Maps message type name to descriptor MessageCache map[string]*desc.MessageDescriptor // Maps services name to descriptor ServiceCache map[string]*desc.ServiceDescriptor }
Collector holds onto a cache of descriptors
func NewCollector ¶
func NewCollector(fileDescriptors []*desc.FileDescriptor) *Collector
NewCollector returns an instance of a Collector struct
func (*Collector) AddDescriptors ¶
func (c *Collector) AddDescriptors(fileDescriptors []*desc.FileDescriptor)
AddDescriptors takes a slice of file descriptors, walks them, and then saves all message and service descriptors to a cache with the key as the FQDN
func (*Collector) GetMessage ¶
func (c *Collector) GetMessage(name string) (*desc.MessageDescriptor, error)
GetMessage takes a message descriptor's FQDN and returns the descriptor or an error if not found
func (*Collector) GetService ¶
func (c *Collector) GetService(name string) (*desc.ServiceDescriptor, error)
GetService takes a service descriptor's FQDN and returns the descriptor or an error if not found
func (*Collector) ListServices ¶
func (c *Collector) ListServices()
ListServices lists back the services in a formatted method