Documentation ¶
Overview ¶
Package protoplugin provides utilities for protoc plugins.
The only functions that should be called as of now is Main. The rest are not guaranteed to stay here.
This was HEAVILY adapted from github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway.
Eventually, a rewrite of this to be simplier for what we need would be nice, but this was available to get us here, especially with handling go imports.
Note that "FQMN", "FQSN", etc stand for "Fully Qualified Message Name", "Fully Qualified Service Name", etc, which denotes the package and object name together.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Enum ¶
type Enum struct { *descriptor.EnumDescriptorProto File *File // Outers is a list of outer messages if this enum is a nested type. Outers []string Index int }
Enum describes a protocol buffer enum type.
type Field ¶
type Field struct { *descriptor.FieldDescriptorProto // Message is the message type which this field belongs to. Message *Message // FieldMessage is the message type of the field. FieldMessage *Message }
Field wraps descriptor.FieldDescriptorProto for richer features.
type FieldPath ¶
type FieldPath []*FieldPathComponent
FieldPath is a path to a field from a request message.
func (FieldPath) IsNestedProto3 ¶
IsNestedProto3 indicates whether the FieldPath is a nested Proto3 path.
type FieldPathComponent ¶
type FieldPathComponent struct { // Name is a name of the proto field which this component corresponds to. Name string // Target is the proto field which this component corresponds to. Target *Field }
FieldPathComponent is a path component in FieldPath
func (*FieldPathComponent) LHS ¶
func (c *FieldPathComponent) LHS() string
LHS returns a left-hand-side expression in go for this field.
func (*FieldPathComponent) RHS ¶
func (c *FieldPathComponent) RHS() string
RHS returns a right-hand-side expression in go for this field.
type File ¶
type File struct { *descriptor.FileDescriptorProto GoPackage *GoPackage Messages []*Message Enums []*Enum Services []*Service }
File wraps descriptor.FileDescriptorProto for richer features.
type GoPackage ¶
type GoPackage struct { Path string Name string // Alias is an alias of the package unique within the current invocation of the generator. Alias string }
GoPackage represents a golang package.
type Message ¶
type Message struct { *descriptor.DescriptorProto File *File // Outers is a list of outer messages if this message is a nested type. Outers []string Fields []*Field // Index is proto path index of this message in File. Index int }
Message describes a protocol buffer message types.
type Method ¶
type Method struct { *descriptor.MethodDescriptorProto Service *Service RequestType *Message ResponseType *Message }
Method wraps descriptor.MethodDescriptorProto for richer features.
type Service ¶
type Service struct { *descriptor.ServiceDescriptorProto File *File Methods []*Method }
Service wraps descriptor.ServiceDescriptorProto for richer features.
type TemplateInfo ¶
TemplateInfo is the info passed to a template.