Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyPluginFunction ¶
func ApplyPluginFunction(f GenerateFileFunc, req *pluginpb.CodeGeneratorRequest) *pluginpb.CodeGeneratorResponse
ApplyPluginFunction applies `f` to all FileToGenerate inside request
Returns combined plugin response
func ReadCodeGenerationRequest ¶
func ReadCodeGenerationRequest(descriptor string, filesToGenerate ...string) (*pluginpb.CodeGeneratorRequest, error)
ReadCodeGenerationRequest will create CodeGeneratorRequest from provided descriptor set. It'll not use protoc command to generate it.
Types ¶
type GenerateFileFunc ¶
GenerateFileFunc is function that takes generator as input and generate each of the files
type Parser ¶
type Parser struct { // ProtoPaths Specifies the directories in which to search for imports. Directories will be searched in specified order. // If not given, the current working directory is used. // If not found in any of the these directories, the DescriptorsSet descriptors will be checked for required proto file. // For each element -I<element> protoc argument will be added. ProtoPaths []string // DescriptorsSet specifies a list of FILES each containing a FileDescriptorSet (a protocol buffer defined in descriptor.proto). // The FileDescriptor for each of the PROTO_FILES provided will be loaded from these FileDescriptorSets. // If a FileDescriptor appears multiple times, the first occurrence will be used. // If is not empty --descriptor_set_in=<FILES> protoc argument will be added, where <FILES> is comma separated list of files. DescriptorsSet []string // IncludeImports also includes all dependencies of the input files in the set, so that the set is self-contained. // If set to true --include_imports protoc argument will be added. IncludeImports bool // IncludeSourceInfo will create descriptors that include information about the original location of each decl in the source file // as well as surrounding comments. // If set to true --include_source_info protoc argument will be added. IncludeSourceInfo bool // Path to protoc compiler. If not set up - will be searched in PATH. Protoc string // DescriptorsSetOut holds filepath where to store generated proto descriptor. descriptor_set_out DescriptorsSetOut string }
Parser parses proto source into descriptors.
func (Parser) CodeGenerationRequest ¶
func (p Parser) CodeGenerationRequest(filesToGenerate ...string) (*pluginpb.CodeGeneratorRequest, error)
TODO test that CodeGenerationRequest will return pluginpb.CodeGeneratorRequest for provided files.
Click to show internal directories.
Click to hide internal directories.