Documentation ¶
Index ¶
- Constants
- func Gen(genReq *plugin.CodeGeneratorRequest) (*plugin.CodeGeneratorResponse, error)
- type Command
- type Flag
- func (f *Flag) GenFlag(in string) string
- func (f *Flag) GenOneOfVarName(in string) string
- func (f *Flag) GenOtherVarName(in string) string
- func (f *Flag) GenRequired() string
- func (f *Flag) InputFieldName() string
- func (f *Flag) IsEnum() bool
- func (f *Flag) IsMessage() bool
- func (f *Flag) OneOfInputFieldName() string
- type NestedMessage
Constants ¶
const ( // EmptyProtoType is the type name for the Empty message type EmptyProtoType = ".google.protobuf.Empty" // LROProtoType is the type name for the LRO message type LROProtoType = ".google.longrunning.Operation" // OutputOnlyStr represents the comment-level string that // indicates a field is only present as output, never input OutputOnlyStr = "Output only" // RequiredStr represents the comment-level string that // indicates a field is required RequiredStr = "Required" )
const ( // ShortDescMax is the maximum length accepted for // the Short usage docs ShortDescMax = 50 )
Variables ¶
This section is empty.
Functions ¶
func Gen ¶
func Gen(genReq *plugin.CodeGeneratorRequest) (*plugin.CodeGeneratorResponse, error)
Gen is the main entry point for code generation of a command line utility
Types ¶
type Command ¶
type Command struct { Service string Method string MethodCmd string InputMessageType string InputMessage string ShortDesc string LongDesc string Imports map[string]*pbinfo.ImportSpec Flags []*Flag OneOfSelectors map[string]*Flag NestedMessages []*NestedMessage EnvPrefix string OutputMessageType string ServerStreaming bool ClientStreaming bool Paged bool IsLRO bool HasEnums bool SubCommands []*Command }
Command intermediate representation of a RPC/Method as a CLI command
type Flag ¶
type Flag struct { Name string Type descriptor.FieldDescriptorProto_Type Message string Repeated bool Required bool Usage string MessageImport pbinfo.ImportSpec OneOfs map[string]*Flag IsOneOfField bool IsNested bool }
Flag is used to represent fields as flags
func (*Flag) GenOneOfVarName ¶
GenOneOfVarName generates the variable name for a oneof entry type
func (*Flag) GenOtherVarName ¶
GenOtherVarName generates the Go variable to store repeated Message & Enum string values
func (*Flag) GenRequired ¶
GenRequired generates the code to mark the flag as required
func (*Flag) InputFieldName ¶
InputFieldName converts the field name into the Go struct property name
func (*Flag) OneOfInputFieldName ¶
OneOfInputFieldName converts the field name into the Go struct property name for a oneof field, which excludes the oneof definition name
type NestedMessage ¶
NestedMessage represents a nested message that will need to be initialized in the generated code