utils

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGenRequest

func CreateGenRequest(fds *descriptor.FileDescriptorSet, filesToGen ...string) *plugin_go.CodeGeneratorRequest

CreateGenRequest creates a codegen request from a `FileDescriptorSet`

func FilesToGenerate

func FilesToGenerate(req *plugin_go.CodeGeneratorRequest) []*descriptor.FileDescriptorProto

FilesToGenerate iterates through the proto files in the request and returns only the ones that were requested on the command line. Only these protos should be generated by a codegen plugin.

func FindDescriptor

FindDescriptor finds the named descriptor in the given set. Only base names are searched. The first match is returned, on `nil` if not found

func InStringSlice

func InStringSlice(sl []string, val string) bool

InStringSlice returns whether or not the supplied value is in the slice

func LoadDescriptor

func LoadDescriptor(name string, pathSegments ...string) (*descriptor.FileDescriptorProto, error)

LoadDescriptor loads file descriptor protos from a file on disk, and returns the named proto descriptor. This is useful mostly for testing purposes.

func LoadDescriptorSet

func LoadDescriptorSet(pathSegments ...string) (*descriptor.FileDescriptorSet, error)

LoadDescriptorSet loads a `FileDescriptorSet` from a file on disk. Such a file can be generated using the `--descriptor_set_out` flag with `protoc`.

Example:

protoc --descriptor_set_out=fileset.pb --include_imports --include_source_info ./booking.proto ./todo.proto

Types

This section is empty.

Jump to

Keyboard shortcuts

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