Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoTypeNameFromFullyQualified ¶
GoTypeNameFromFullyQualified returns a go type name from a fully qualified type name. For example, if typ is `.com.example.v1.CreateRequest`, it returns `v1.CreateRequest`. The fully qualified type name is typically from FieldDescriptorProto.TypeName.
Types ¶
type APIDescriptor ¶
type APIDescriptor struct {
// contains filtered or unexported fields
}
APIDescriptor describes a gRPC API from a proto file.
func NewAPIDescriptor ¶
func NewAPIDescriptor(f *descriptorpb.FileDescriptorProto) *APIDescriptor
func (*APIDescriptor) APIVersion ¶
func (a *APIDescriptor) APIVersion() string
APIVersion returns the API version from the package name. For example, if the package name is "com.example.v1", it returns "v1".
func (*APIDescriptor) ImportPath ¶
func (a *APIDescriptor) ImportPath() *v1.ImportPath
ImportPath returns the import path from the go_package option. For example, if the go_package option is "com.example.v1;example", it returns "com.example.v1".
func (*APIDescriptor) ServiceName ¶
func (a *APIDescriptor) ServiceName() string
ServiceName returns the service name from the package name. For example, if the package name is "com.example.v1", it returns "example".
type ListResponseDescriptor ¶
type ListResponseDescriptor struct {
// contains filtered or unexported fields
}
func NewListResponseDescriptor ¶
func NewListResponseDescriptor(f *descriptorpb.FileDescriptorProto, m *descriptorpb.MethodDescriptorProto) *ListResponseDescriptor
func (*ListResponseDescriptor) ListField ¶
func (l *ListResponseDescriptor) ListField() (string, error)
ListField returns the field name of the resource list.
The response message of the list method must have two fields. One is the resource list and the other is the next page token. If the response message has more than two fields, it returns an error.
For example, the following response message has two fields: ```
message ListClusterResponse { repeated Cluster clusters = 1; string next_page_token = 2; }
``` In this case, it returns `Clusters`.
type MethodDescriptor ¶
type MethodDescriptor struct {
*descriptorpb.MethodDescriptorProto
}
MethodDescriptor describes a gRPC method from a proto file.
func NewMethodDescriptor ¶
func NewMethodDescriptor(m *descriptorpb.MethodDescriptorProto) *MethodDescriptor
func (*MethodDescriptor) ResourceName ¶
func (m *MethodDescriptor) ResourceName() string
ResourceName returns a resource name from a method type. For example, if the method type is `Create` and the method name is `CreateFoo`, it returns `Foo`.
func (*MethodDescriptor) Type ¶
func (m *MethodDescriptor) Type() v1.MethodType
Type returns a method type. It determines the type of the method from its name.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is a plugin for protoc.
func NewPlugin ¶
func NewPlugin(handler func(*pluginpb.CodeGeneratorRequest) (*pluginpb.CodeGeneratorResponse, error)) *Plugin
NewPlugin returns a new Plugin with stdin and stdout.
func (*Plugin) MarshalJsonProto ¶
MarshalJSONProto marshals a proto message to JSON in protojson format.
If the parameter is "multiline", the output is formatted with newlines and indentation.
func (*Plugin) Run ¶
Run reads CodeGeneratorRequest from stdin, writes CodeGeneratorResponse to stdout.
if the parameter is "debug", it writes debug messages to stderr.