Documentation
¶
Index ¶
- Variables
- func CompileProto(root string) (io.ReadCloser, error)
- func ConvertFilesToTypes(files *protoregistry.Files) (*protoregistry.Types, error)
- func FindProtoFiles(root string) ([]string, error)
- func LoadImage(r io.Reader) (*descriptorpb.FileDescriptorSet, error)
- func NewCommand() *cobra.Command
- type OutputFormat
- type TypedDescriptor
Constants ¶
This section is empty.
Variables ¶
View Source
var OutputFormatOptions = map[OutputFormat][]string{ TextOutputFormat: {"text"}, JsonOutputFormat: {"json"}, DebugOutputFormat: {"debug"}, }
OutputFormatOptions contains the textual value of the output format, which can be used in command-line flags.
Functions ¶
func CompileProto ¶
func CompileProto(root string) (io.ReadCloser, error)
CompileProto invokes protoc to generate a file descriptor set. The caller is responsible for calling Close() on the reader.
func ConvertFilesToTypes ¶
func ConvertFilesToTypes(files *protoregistry.Files) (*protoregistry.Types, error)
func FindProtoFiles ¶
func LoadImage ¶
func LoadImage(r io.Reader) (*descriptorpb.FileDescriptorSet, error)
LoadImage loads a preprocessed FileDescriptorSet from an image. Said image could be generated using:
find . -name '*.proto' | xargs protoc--descriptor_set_out=all.image
whereby 'all.image' would be passed into this function.
func NewCommand ¶
Types ¶
type OutputFormat ¶
type OutputFormat enumflag.Flag
const ( // TextOutputFormat emits prototext representation. TextOutputFormat OutputFormat = iota // JsonOutputFormat emits protojson representation. JsonOutputFormat // DebugOutputFormat emits internal go structure. It mostly looks like // prototext, except it does not attempt to parse certain well-known fields, // such as google.protobuf.Any. Such fields may be displayed as raw bytes. DebugOutputFormat )
type TypedDescriptor ¶
type TypedDescriptor interface { Enums() protoreflect.EnumDescriptors Extensions() protoreflect.ExtensionDescriptors Messages() protoreflect.MessageDescriptors }
Click to show internal directories.
Click to hide internal directories.