Documentation
¶
Index ¶
- Variables
- func AddFileContentToFinder(f Finder, pr *descriptorpb.FileDescriptorProto, lang LanguageText)
- func BasicGenerate(g Generator, t *template.Template, info *GenInfo, impToPkg map[string]string) ([]*util.OutputFile, error)
- func BasicTypeToString(l LanguageText, s string, panicOnFail bool) string
- func FuncParamPass(method *WasmMethod, ...) string
- func LastSegmentOfPackage(pkg string) string
- func MethodsPass(gen *GenInfo, ...)
- func PackageToGoName(pkg string) string
- func RemoveDots(str string) string
- func ToCamelCase(snake string) string
- func ToCamelCaseFirstLower(snake string) string
- func ToLowerNoService(snake string) string
- func ToSnakeCase(camel string) string
- func ToSnakeCaseFirstUpper(camel string) string
- type AbiLanguageText
- type CGParameter
- func ExpandParamInfoForInput(in *InputParam, m *WasmMethod, protoPkg string) []*CGParameter
- func ExpandReturnInfoForOutput(out *OutputParam, m *WasmMethod, protoPkg string) *CGParameter
- func NewCGParameterFromField(f *WasmField, m *WasmMethod, protoPkg string) *CGParameter
- func NewCGParameterFromString(s string, cgType *CGType) *CGParameter
- func NewCGParameterNoFormal(cgType *CGType) *CGParameter
- type CGType
- func GetCGTypeForInputParam(i *InputParam) *CGType
- func GetCGTypeForOutputParam(o *OutputParam) *CGType
- func NewCGTypeFromBasic(tname string, l LanguageText, protoPkg string) *CGType
- func NewCGTypeFromComposite(m *WasmMessage, l LanguageText, f Finder, protoPackage string) *CGType
- func NewCGTypeFromField(f *WasmField, m *WasmMethod, protoPkg string) *CGType
- func NewCGTypeFromInput(in *InputParam, m *WasmMethod, protoPkg string) *CGType
- func NewCGTypeFromOutput(out *OutputParam, m *WasmMethod, protoPkg string) *CGType
- func (c *CGType) Basic() string
- func (c *CGType) CompositeType() *WasmMessage
- func (c *CGType) HasValueBeenSet() bool
- func (c *CGType) IsBasic() bool
- func (c *CGType) IsCompositeNoFields() bool
- func (c *CGType) IsEmpty() bool
- func (c *CGType) IsStrictWasmType() bool
- func (c *CGType) Parts() string
- func (c *CGType) SetEmpty()
- func (c *CGType) ShortName() string
- func (c *CGType) String(from string) string
- func (c *CGType) StringNotInProto() string
- type Finder
- type FiveWithMethodString
- type FuncChooser
- type GenInfo
- func (g *GenInfo) AddMessageType(name, protoPackage, goPackage string, message *WasmMessage)
- func (g *GenInfo) AddServiceType(wasmName, protoPackage, goPackage string, service *WasmService)
- func (g *GenInfo) AddressingNameFromMessage(currentPkg string, message *WasmMessage) string
- func (g *GenInfo) Contains(name string) bool
- func (g *GenInfo) FindMessageByName(protoPackage string, name string) *WasmMessage
- func (g *GenInfo) FindServiceByName(protoPackage, name string) *WasmService
- func (g *GenInfo) GetAllFileName() []string
- func (g *GenInfo) GetAllMessageByName(generatedFile string) []*descriptorpb.DescriptorProto
- func (g *GenInfo) GetAllServiceByName(generatedFile string) []*descriptorpb.ServiceDescriptorProto
- func (g *GenInfo) GetFileByName(name string) *descriptorpb.FileDescriptorProto
- func (g *GenInfo) GetRequest() *pluginpb.CodeGeneratorRequest
- func (g *GenInfo) GetService(name string) []*descriptorpb.ServiceDescriptorProto
- func (g *GenInfo) GoPackageOption(service []*WasmService, message []*WasmMessage) (string, error)
- func (g *GenInfo) Message() []*WasmMessage
- func (g *GenInfo) RegisterMessage(w *WasmMessage)
- func (g *GenInfo) RegisterService(w *WasmService)
- func (g *GenInfo) Service() []*WasmService
- func (g *GenInfo) SetReqAndFileMappings(request *pluginpb.CodeGeneratorRequest, ...)
- type Generator
- type InputParam
- func (i *InputParam) CGType() *CGType
- func (i *InputParam) GetLanguage() LanguageText
- func (i *InputParam) GetParent() *WasmMethod
- func (i *InputParam) GetTypeName() string
- func (i *InputParam) IsEmpty() bool
- func (i *InputParam) Len() int
- func (i *InputParam) SetCGType(cg *CGType)
- func (i *InputParam) SetEmpty()
- type LanguageText
- type MessageRecord
- type OutputParam
- func (o *OutputParam) CGType() *CGType
- func (o *OutputParam) GetCGType() *CGType
- func (o *OutputParam) GetLanguage() LanguageText
- func (o *OutputParam) GetParent() *WasmMethod
- func (o *OutputParam) GetTypeName() string
- func (o *OutputParam) IsEmpty() bool
- func (o *OutputParam) IsMultipleReturn() bool
- func (o *OutputParam) Len() int
- func (o *OutputParam) SetCGType(c *CGType)
- func (o *OutputParam) SetEmpty()
- type QuadOptions
- type QuadString
- type QuadWithMethodBool
- type QuadWithMethodString
- type ServiceRecord
- type SimpleFinder
- func (s *SimpleFinder) AddMessageType(name, protoPackage, goPackage string, message *WasmMessage)
- func (s *SimpleFinder) AddServiceType(wasmName, protoPackage, goPackage string, service *WasmService)
- func (s *SimpleFinder) AddressingNameFromMessage(currentPkg string, message *WasmMessage) string
- func (s *SimpleFinder) FindMessageByName(protoPackage string, name string) *WasmMessage
- func (s *SimpleFinder) FindServiceByName(protoPackage string, name string) *WasmService
- func (s *SimpleFinder) GoPackageOption(service []*WasmService, message []*WasmMessage) (string, error)
- func (s *SimpleFinder) Message() []*WasmMessage
- func (s *SimpleFinder) Service() []*WasmService
- type WasmField
- type WasmMessage
- func (m *WasmMessage) Collect()
- func (w *WasmMessage) GetAddressableName(from string) string
- func (m *WasmMessage) GetField() []*WasmField
- func (w *WasmMessage) GetFinder() Finder
- func (m *WasmMessage) GetFullName() string
- func (w *WasmMessage) GetGoPackage() string
- func (m *WasmMessage) GetParent() *descriptorpb.FileDescriptorProto
- func (w *WasmMessage) GetProtoPackage() string
- func (w *WasmMessage) GetWasmMessageName() string
- func (m *WasmMessage) IsInputSource() bool
- func (m *WasmMessage) IsOutputTarget() bool
- func (m *WasmMessage) MarkSource(isInput bool, method *WasmMethod)
- type WasmMethod
- func (w *WasmMethod) AddImportsNeeded(imp map[string]struct{})
- func (w *WasmMethod) CGInput() *InputParam
- func (w *WasmMethod) CGOutput() *OutputParam
- func (m *WasmMethod) EmtpyInput() bool
- func (m *WasmMethod) EmtpyOutput() bool
- func (w *WasmMethod) Finder() Finder
- func (m *WasmMethod) FuncChoice() *FuncChooser
- func (w *WasmMethod) GetOutputFields() []*WasmField
- func (w *WasmMethod) GoPackage() string
- func (m *WasmMethod) InputCodeNeeded() bool
- func (w *WasmMethod) InputFields() []*WasmField
- func (m *WasmMethod) InputParam() *InputParam
- func (m *WasmMethod) Language() LanguageText
- func (m *WasmMethod) MarkInputOutputMessages()
- func (m *WasmMethod) NotEmptyOutput() bool
- func (m *WasmMethod) NotEmtpyInput() bool
- func (m *WasmMethod) OutputCodeNeeded() bool
- func (m *WasmMethod) OutputParam() *OutputParam
- func (m *WasmMethod) Parent() *WasmService
- func (w *WasmMethod) ProtoPackage() string
- func (w *WasmMethod) SetProtoPackage(p string) string
- func (w *WasmMethod) WasmMethodName() string
- type WasmService
- func (s *WasmService) AddImportsNeeded(imp map[string]struct{})
- func (s *WasmService) Collect()
- func (w *WasmService) Finder() Finder
- func (w *WasmService) GetGoPackage() string
- func (w *WasmService) GetLanguage() LanguageText
- func (s *WasmService) GetParent() *descriptorpb.FileDescriptorProto
- func (w *WasmService) GetProtoPackage() string
- func (s *WasmService) GetWasmMethod() []*WasmMethod
- func (w *WasmService) GetWasmServiceErrId() string
- func (w *WasmService) GetWasmServiceName() string
- func (w *WasmService) ImplementsReverseAPI() string
- func (w *WasmService) IsWasmServiceReverseAPI() bool
- func (s *WasmService) NoMethod() bool
Constants ¶
This section is empty.
Variables ¶
var FuncMap = template.FuncMap{ "toCamelCase": ToCamelCase, "toSnakeCase": ToSnakeCase, "packageToGoName": PackageToGoName, "toSnakeCaseFirstUpper": ToSnakeCaseFirstUpper, "toCamelCaseFirstLower": ToCamelCaseFirstLower, "toLowerNoService": ToLowerNoService, "LastSegmentOfPackage": LastSegmentOfPackage, "BasicTypeToString": BasicTypeToString, "RemoveDots": RemoveDots, }
FuncMap is "default" function map for use with the templates. This contains generally useful helper functions.
Functions ¶
func AddFileContentToFinder ¶
func AddFileContentToFinder(f Finder, pr *descriptorpb.FileDescriptorProto, lang LanguageText)
func BasicGenerate ¶
func BasicGenerate(g Generator, t *template.Template, info *GenInfo, impToPkg map[string]string) ([]*util.OutputFile, error)
BasicGenerate is the primary code generation driver. Language-specific code (in generator.Generate()) is called and that code typically does some setup and then calls into this code, passing itself as the g. This function expects the GenInfo to have been created and filled out prior to arriving here. Because of the chaining api, t actually is represents _all_ the templates (not just one) that are associated with generator g. This is called once per .proto file processed.
func BasicTypeToString ¶
func BasicTypeToString(l LanguageText, s string, panicOnFail bool) string
func FuncParamPass ¶
func FuncParamPass(method *WasmMethod, fn func(method *WasmMethod, num int, parameter *CGParameter) string, empty func(method *WasmMethod, isInput bool, param *CGParameter) string) string
func LastSegmentOfPackage ¶
LastSegmentOfPackage takes a file to be generated file file/v1/file.proto and converts it to v1.
func MethodsPass ¶
func MethodsPass(gen *GenInfo, fn func(info *GenInfo, svc *WasmService, method *WasmMethod, parameter *CGParameter) string, empty func(info *GenInfo, svc *WasmService, method *WasmMethod, isInput bool, param *CGParameter) string)
func PackageToGoName ¶
func RemoveDots ¶
RemoveDots takes a string and returns it without dots.
func ToCamelCase ¶
ToCamelCase converts from snake case to camel case. If the first or last character is a underscore, it is left alone.
func ToCamelCaseFirstLower ¶
func ToLowerNoService ¶
func ToSnakeCase ¶
ToSnakeCase converts from CamelCase to snake_case.
func ToSnakeCaseFirstUpper ¶
ToSnakeCaseFirstUpper converts from CamelCase to snake_case but makes sure the first character is upper.
Types ¶
type AbiLanguageText ¶
type AbiLanguageText interface { LanguageText AllInputWithFormalWasmLevel(m *WasmMethod, showFormalName bool) string AllInputWasmToGoImpl(m *WasmMethod) string }
AbiLanguageText is only for methods that are used by the ABI. Since the ABI is currently implemented in go, only the abi "language" uses this and it generates go code. Other languages can safely ignore this.
type CGParameter ¶
type CGParameter struct {
// contains filtered or unexported fields
}
func ExpandParamInfoForInput ¶
func ExpandParamInfoForInput(in *InputParam, m *WasmMethod, protoPkg string) []*CGParameter
func ExpandReturnInfoForOutput ¶
func ExpandReturnInfoForOutput(out *OutputParam, m *WasmMethod, protoPkg string) *CGParameter
func NewCGParameterFromField ¶
func NewCGParameterFromField(f *WasmField, m *WasmMethod, protoPkg string) *CGParameter
func NewCGParameterFromString ¶
func NewCGParameterFromString(s string, cgType *CGType) *CGParameter
func NewCGParameterNoFormal ¶
func NewCGParameterNoFormal(cgType *CGType) *CGParameter
func (*CGParameter) GetCGType ¶
func (c *CGParameter) GetCGType() *CGType
func (*CGParameter) GetFormalName ¶
func (c *CGParameter) GetFormalName() string
func (*CGParameter) HasFormal ¶
func (c *CGParameter) HasFormal() bool
func (*CGParameter) String ¶
func (c *CGParameter) String(from string) string
type CGType ¶
type CGType struct {
// contains filtered or unexported fields
}
func GetCGTypeForInputParam ¶
func GetCGTypeForInputParam(i *InputParam) *CGType
func GetCGTypeForOutputParam ¶
func GetCGTypeForOutputParam(o *OutputParam) *CGType
func NewCGTypeFromBasic ¶
func NewCGTypeFromBasic(tname string, l LanguageText, protoPkg string) *CGType
func NewCGTypeFromComposite ¶
func NewCGTypeFromComposite(m *WasmMessage, l LanguageText, f Finder, protoPackage string) *CGType
func NewCGTypeFromField ¶
func NewCGTypeFromField(f *WasmField, m *WasmMethod, protoPkg string) *CGType
func NewCGTypeFromInput ¶
func NewCGTypeFromInput(in *InputParam, m *WasmMethod, protoPkg string) *CGType
func NewCGTypeFromOutput ¶
func NewCGTypeFromOutput(out *OutputParam, m *WasmMethod, protoPkg string) *CGType
func (*CGType) CompositeType ¶
func (c *CGType) CompositeType() *WasmMessage
func (*CGType) HasValueBeenSet ¶
func (*CGType) IsCompositeNoFields ¶
func (*CGType) IsStrictWasmType ¶
func (*CGType) ShortName ¶
ShortName is very dangerous. Almost all callers actually want String(string) because it calculates the corect way to address the type. This function returns the name raw.
func (*CGType) StringNotInProto ¶
type Finder ¶
type Finder interface { FindMessageByName(protoPkg string, messageName string) *WasmMessage FindServiceByName(protoPkg string, messageName string) *WasmService AddMessageType(wasmName, protoPackage, goPackage string, message *WasmMessage) AddServiceType(wasmName, protoPackage, goPackage string, service *WasmService) AddressingNameFromMessage(currentPkg string, message *WasmMessage) string GoPackageOption(service []*WasmService, message []*WasmMessage) (string, error) Service() []*WasmService Message() []*WasmMessage }
type FiveWithMethodString ¶
type FiveWithMethodString func(b1, b2, b3, b4, abi bool, m *WasmMethod) string
type FuncChooser ¶
type FuncChooser struct { Bits QuadString NeedsFillIn QuadOptions NeedsFillOut QuadOptions NeedsRet QuadOptions InputParam QuadWithMethodString OutputParam QuadWithMethodString NeedsPullApart QuadOptions Inbound QuadWithMethodString Outbound QuadWithMethodString RetError QuadWithMethodString RetValue QuadWithMethodString MethodRet FiveWithMethodString ZeroValueRet FiveWithMethodString MethodParamDecl QuadWithMethodString OutLocal QuadWithMethodString MethodCall QuadWithMethodString DecodeRequired QuadWithMethodBool NoDecodeRequired QuadWithMethodBool UsesReturnValuePtr QuadWithMethodBool MethodParamDeclWasm QuadWithMethodString HasComplexParam QuadWithMethodBool MethodCallWasm QuadWithMethodString InputToSend QuadWithMethodString DispatchParam QuadWithMethodString DispatchResult QuadWithMethodString InParamDecl QuadWithMethodString OutParamDecl QuadWithMethodString BindDirection QuadWithMethodString GenMethodPossibleTest func(m *WasmMethod) bool }
type GenInfo ¶
type GenInfo struct {
// contains filtered or unexported fields
}
func Collect ¶
func Collect(result *GenInfo, lang LanguageText) *GenInfo
Collect is called to gather all the relevant information about the proto files into the given GenInfo object. It walks the full proto file as specified by proto.
func NewGenInfo ¶
func NewGenInfo() *GenInfo
func (*GenInfo) AddMessageType ¶
func (g *GenInfo) AddMessageType(name, protoPackage, goPackage string, message *WasmMessage)
func (*GenInfo) AddServiceType ¶
func (g *GenInfo) AddServiceType(wasmName, protoPackage, goPackage string, service *WasmService)
func (*GenInfo) AddressingNameFromMessage ¶
func (g *GenInfo) AddressingNameFromMessage(currentPkg string, message *WasmMessage) string
func (*GenInfo) FindMessageByName ¶
func (g *GenInfo) FindMessageByName(protoPackage string, name string) *WasmMessage
func (*GenInfo) FindServiceByName ¶
func (g *GenInfo) FindServiceByName(protoPackage, name string) *WasmService
func (*GenInfo) GetAllFileName ¶
GetAllFileName returns the list of string (keys in the two maps) that are visible to this genInfo.
func (*GenInfo) GetAllMessageByName ¶
func (g *GenInfo) GetAllMessageByName(generatedFile string) []*descriptorpb.DescriptorProto
func (*GenInfo) GetAllServiceByName ¶
func (g *GenInfo) GetAllServiceByName(generatedFile string) []*descriptorpb.ServiceDescriptorProto
func (*GenInfo) GetFileByName ¶
func (g *GenInfo) GetFileByName(name string) *descriptorpb.FileDescriptorProto
func (*GenInfo) GetRequest ¶
func (g *GenInfo) GetRequest() *pluginpb.CodeGeneratorRequest
GetRequest returns the original request data structure that was delivered via stdin. This request is associated with the currently operating code generation.
func (*GenInfo) GetService ¶
func (g *GenInfo) GetService(name string) []*descriptorpb.ServiceDescriptorProto
GetService returns all the services we know about that will need to be generated.
func (*GenInfo) GoPackageOption ¶
func (g *GenInfo) GoPackageOption(service []*WasmService, message []*WasmMessage) (string, error)
func (*GenInfo) Message ¶
func (g *GenInfo) Message() []*WasmMessage
Message returns all the wasm messages of this GenInfo. The caller should not change these values, these are pointers in the real data structures.
func (*GenInfo) RegisterMessage ¶
func (g *GenInfo) RegisterMessage(w *WasmMessage)
func (*GenInfo) RegisterService ¶
func (g *GenInfo) RegisterService(w *WasmService)
func (*GenInfo) Service ¶
func (g *GenInfo) Service() []*WasmService
Service returns all the wasm services of this GenInfo. The caller should not change these values, these are pointers in the real data structures.
func (*GenInfo) SetReqAndFileMappings ¶
func (g *GenInfo) SetReqAndFileMappings(request *pluginpb.CodeGeneratorRequest, n map[string]*descriptorpb.FileDescriptorProto, s map[string][]*descriptorpb.ServiceDescriptorProto, m map[string][]*descriptorpb.DescriptorProto, et map[string][]*descriptorpb.EnumDescriptorProto, ev map[string][]*descriptorpb.EnumValueDescriptorProto)
type Generator ¶
type Generator interface { Process(proto *descriptorpb.FileDescriptorProto) error Generate(t *template.Template, g *GenInfo, imp2Pkg map[string]string) ([]*util.OutputFile, error) TemplateName() []string FuncMap() template.FuncMap GeneratingMessage() []string ResultName() []string LanguageText() LanguageText }
Generator represents a language-specific collection of files and code that can convert a parigot proto file into code for the specific language.
type InputParam ¶
type InputParam struct {
// contains filtered or unexported fields
}
func (*InputParam) CGType ¶
func (i *InputParam) CGType() *CGType
func (*InputParam) GetLanguage ¶
func (i *InputParam) GetLanguage() LanguageText
func (*InputParam) GetParent ¶
func (i *InputParam) GetParent() *WasmMethod
func (*InputParam) GetTypeName ¶
func (i *InputParam) GetTypeName() string
func (*InputParam) IsEmpty ¶
func (i *InputParam) IsEmpty() bool
func (*InputParam) Len ¶
func (i *InputParam) Len() int
func (*InputParam) SetCGType ¶
func (i *InputParam) SetCGType(cg *CGType)
func (*InputParam) SetEmpty ¶
func (i *InputParam) SetEmpty()
type LanguageText ¶
type LanguageText interface { NilValue() string // EmptyComposite takes a type name and returns the empty value of that // composite. This is the brother of the ZeroValuesForProtoTypes that does // the same thing basic types. This returns Foo{} for the input of Foo in // go. The second values is only for people doing their own namespacing. EmptyComposite(typeName string, method *WasmMethod) string // GetNumberParametersUsed returns how many parameters on WASM does it take // to encode this type. Note: this is specific to the compiler. GetNumberParametersUsed(*CGType) int // GetFormalArgSeparator returns the string that separates arguments in // declaration or call. In go this is a comma. e.g foo(a,b,c) because // comma. FormalArgSeparator() string // GetFormalTypeCombination returns has the combination of a formal declaration // and a type. It can produce its output in any order or drop the type in // entirely in languages that don't require. Note that the text of these // two values have already been processed. For ("a","foo") go returns "a foo". FormalTypeCombination(formal, typ string) string // BasicTypeToString returns the language specific version of the input // or panics because it does not know how. The caller should insure // that the value sent to this function is in fact a basic type like // TYPE_STRING or TYPE_INT32. If the second parameter is true, this // function panics on unknown strings, which is usually what you want. BasicTypeToString(string, bool) string // BasicTypeToWasm returns the language and compiler specific mapping // of basic types to a sequence of the 4 wasm types. Note that the // return value here is still in the form "TYPE_INT32" that is from // proto. To get the final type, use BasicTypeToString. BasicTypeToWasm(string) []string // ZeroValuesForProtoTypes returns an empty or initial value for a basic type. This is used where // we have to create a "dummy" value for the type. Generally this value is // not going to be sued. Returns things like // int64(0) ZeroValuesForProtoTypes(string) string // ToId returns the given value in the appropriate case/style for the language. // For go, this returns camel case identifiers. The second parameter is used // to indicate this is a parameter of a function that we are creating. // The last parameter is only of interest to folks doing their own namespacing; // the method you can get the method name and (via the parent) the service name. // In go, the first letter of a parameter is not capitalized, as would normall // in camel case. ToId(string, bool, *WasmMethod) string // ToTypeName returns the given value in the appropriate case/style for the language. // For go, this is lower case for the components of the string before the // last one, then camel case in the last one. The second parameter indicates // that if possible the caller wants a reference type (a pointer). // The final argument is only of interest to folks doing their own namespacing; // you can get the method name and (via the parent) the service name. // For example, the version converts Foo.Bar.Baz=>foo.bar.Baz // and foo.bar.baz_fleazil => foo.bar.BazFleazil ToTypeName(string, bool, *WasmMethod) string // Table driven maker of choices FuncChoice() *FuncChooser }
type MessageRecord ¶
type MessageRecord struct {
// contains filtered or unexported fields
}
func NewMessageRecord ¶
func NewMessageRecord(name, protoPackage, goPackage string) *MessageRecord
func (*MessageRecord) String ¶
func (m *MessageRecord) String() string
func (*MessageRecord) WasmName ¶
func (m *MessageRecord) WasmName() string
type OutputParam ¶
type OutputParam struct {
// contains filtered or unexported fields
}
func (*OutputParam) CGType ¶
func (o *OutputParam) CGType() *CGType
func (*OutputParam) GetCGType ¶
func (o *OutputParam) GetCGType() *CGType
func (*OutputParam) GetLanguage ¶
func (o *OutputParam) GetLanguage() LanguageText
func (*OutputParam) GetParent ¶
func (o *OutputParam) GetParent() *WasmMethod
func (*OutputParam) GetTypeName ¶
func (o *OutputParam) GetTypeName() string
func (*OutputParam) IsEmpty ¶
func (o *OutputParam) IsEmpty() bool
func (*OutputParam) IsMultipleReturn ¶
func (o *OutputParam) IsMultipleReturn() bool
func (*OutputParam) Len ¶
func (o *OutputParam) Len() int
func (*OutputParam) SetCGType ¶
func (o *OutputParam) SetCGType(c *CGType)
func (*OutputParam) SetEmpty ¶
func (o *OutputParam) SetEmpty()
type QuadOptions ¶
type QuadString ¶
type QuadWithMethodBool ¶
type QuadWithMethodBool func(b1, b2, b3, b4 bool, m *WasmMethod) bool
type QuadWithMethodString ¶
type QuadWithMethodString func(b1, b2, b3, b4 bool, m *WasmMethod) string
type ServiceRecord ¶
type ServiceRecord struct {
// contains filtered or unexported fields
}
func NewServiceRecord ¶
func NewServiceRecord(wasmName, protoPackage, goPackage string) *ServiceRecord
func (*ServiceRecord) String ¶
func (m *ServiceRecord) String() string
type SimpleFinder ¶
type SimpleFinder struct {
// contains filtered or unexported fields
}
func NewSimpleFinder ¶
func NewSimpleFinder() *SimpleFinder
func (*SimpleFinder) AddMessageType ¶
func (s *SimpleFinder) AddMessageType(name, protoPackage, goPackage string, message *WasmMessage)
func (*SimpleFinder) AddServiceType ¶
func (s *SimpleFinder) AddServiceType(wasmName, protoPackage, goPackage string, service *WasmService)
func (*SimpleFinder) AddressingNameFromMessage ¶
func (s *SimpleFinder) AddressingNameFromMessage(currentPkg string, message *WasmMessage) string
func (*SimpleFinder) FindMessageByName ¶
func (s *SimpleFinder) FindMessageByName(protoPackage string, name string) *WasmMessage
func (*SimpleFinder) FindServiceByName ¶
func (s *SimpleFinder) FindServiceByName(protoPackage string, name string) *WasmService
func (*SimpleFinder) GoPackageOption ¶
func (s *SimpleFinder) GoPackageOption(service []*WasmService, message []*WasmMessage) (string, error)
func (*SimpleFinder) Message ¶
func (s *SimpleFinder) Message() []*WasmMessage
func (*SimpleFinder) Service ¶
func (s *SimpleFinder) Service() []*WasmService
type WasmField ¶
type WasmField struct { *descriptorpb.FieldDescriptorProto // contains filtered or unexported fields }
WasmField is like a descriptorpb.FieldDescriptorProto (which it contains) but also adds things that are specific to parigot, notably wasm-specific names. This should be accessed by .GetWasmField in the templates.
func NewWasmField ¶
func NewWasmField(proto *descriptorpb.FieldDescriptorProto, w *WasmMessage) *WasmField
func (*WasmField) GetGoPackage ¶
func (*WasmField) GetParent ¶
func (m *WasmField) GetParent() *WasmMessage
GetParent returns the parent of this wasm field, which is a wasm message.
func (*WasmField) GetProtoPackage ¶
func (*WasmField) GetWasmFieldName ¶
type WasmMessage ¶
type WasmMessage struct { *descriptorpb.DescriptorProto // contains filtered or unexported fields }
WasmMessage is like a descriptorpb.DescriptorProto (which it contains) but also adds things that are specific to parigot, notably wasm-specific names. This should be accessed by .GetWasmMessage in the templates.
func NewWasmMessage ¶
func NewWasmMessage(file *descriptorpb.FileDescriptorProto, message *descriptorpb.DescriptorProto, lang LanguageText, finder Finder) *WasmMessage
func (*WasmMessage) Collect ¶
func (m *WasmMessage) Collect()
func (*WasmMessage) GetAddressableName ¶
func (w *WasmMessage) GetAddressableName(from string) string
func (*WasmMessage) GetField ¶
func (m *WasmMessage) GetField() []*WasmField
GetField returns all the wasm field contained inside this message.
func (*WasmMessage) GetFinder ¶
func (w *WasmMessage) GetFinder() Finder
func (*WasmMessage) GetFullName ¶
func (m *WasmMessage) GetFullName() string
func (*WasmMessage) GetGoPackage ¶
func (w *WasmMessage) GetGoPackage() string
func (*WasmMessage) GetParent ¶
func (m *WasmMessage) GetParent() *descriptorpb.FileDescriptorProto
GetParent returns the parent of this wasm message, which is a descriptor for the file containing it.
func (*WasmMessage) GetProtoPackage ¶
func (w *WasmMessage) GetProtoPackage() string
func (*WasmMessage) GetWasmMessageName ¶
func (w *WasmMessage) GetWasmMessageName() string
GetWasmMessageName looks through the data structure given that represents the original protobuf structure trying to find constructs like this:
message Foo { option (parigot.wasm_message_name) = "yeech";
If no such construction is found, it returns the simple name.
func (*WasmMessage) IsInputSource ¶
func (m *WasmMessage) IsInputSource() bool
func (*WasmMessage) IsOutputTarget ¶
func (m *WasmMessage) IsOutputTarget() bool
func (*WasmMessage) MarkSource ¶
func (m *WasmMessage) MarkSource(isInput bool, method *WasmMethod)
type WasmMethod ¶
type WasmMethod struct { *descriptorpb.MethodDescriptorProto HostFuncName string // contains filtered or unexported fields }
WasmMethod is like a descriptorpb.MethodDescriptorProto (which it contains) but also adds things that are specific to parigot, notably wasm-specific names. This should be accessed by .GetWasmMethod in the templates.
func NewWasmMethod ¶
func NewWasmMethod(desc *descriptorpb.MethodDescriptorProto, w *WasmService) *WasmMethod
func (*WasmMethod) AddImportsNeeded ¶
func (w *WasmMethod) AddImportsNeeded(imp map[string]struct{})
func (*WasmMethod) CGInput ¶
func (w *WasmMethod) CGInput() *InputParam
func (*WasmMethod) CGOutput ¶
func (w *WasmMethod) CGOutput() *OutputParam
func (*WasmMethod) EmtpyInput ¶
func (m *WasmMethod) EmtpyInput() bool
func (*WasmMethod) EmtpyOutput ¶
func (m *WasmMethod) EmtpyOutput() bool
func (*WasmMethod) Finder ¶
func (w *WasmMethod) Finder() Finder
func (*WasmMethod) FuncChoice ¶
func (m *WasmMethod) FuncChoice() *FuncChooser
func (*WasmMethod) GetOutputFields ¶
func (w *WasmMethod) GetOutputFields() []*WasmField
func (*WasmMethod) GoPackage ¶
func (w *WasmMethod) GoPackage() string
func (*WasmMethod) InputCodeNeeded ¶
func (m *WasmMethod) InputCodeNeeded() bool
func (*WasmMethod) InputFields ¶
func (w *WasmMethod) InputFields() []*WasmField
func (*WasmMethod) InputParam ¶
func (m *WasmMethod) InputParam() *InputParam
func (*WasmMethod) Language ¶
func (m *WasmMethod) Language() LanguageText
func (*WasmMethod) MarkInputOutputMessages ¶
func (m *WasmMethod) MarkInputOutputMessages()
func (*WasmMethod) NotEmptyOutput ¶
func (m *WasmMethod) NotEmptyOutput() bool
func (*WasmMethod) NotEmtpyInput ¶
func (m *WasmMethod) NotEmtpyInput() bool
func (*WasmMethod) OutputCodeNeeded ¶
func (m *WasmMethod) OutputCodeNeeded() bool
func (*WasmMethod) OutputParam ¶
func (m *WasmMethod) OutputParam() *OutputParam
func (*WasmMethod) Parent ¶
func (m *WasmMethod) Parent() *WasmService
Parent returns the parent of this wasm method, which is a wasm service.
func (*WasmMethod) ProtoPackage ¶
func (w *WasmMethod) ProtoPackage() string
func (*WasmMethod) SetProtoPackage ¶
func (w *WasmMethod) SetProtoPackage(p string) string
func (*WasmMethod) WasmMethodName ¶
func (w *WasmMethod) WasmMethodName() string
WasmMethodName looks through the data structure given that represents the original protobuf structure trying to find constructs like this:
service Foo { rpc Baz(BazRequest) returns (BazResponse) { option (parigot.wasm_method_name) = "heffalumph"; }
If no such construction is found, it returns the simple name.
type WasmService ¶
type WasmService struct { *descriptorpb.ServiceDescriptorProto // contains filtered or unexported fields }
WasmService is like a descriptorpb.ServiceDescriptorProto (which it contains) but also adds things that are specific to parigot, notably wasm-specific names. This should be accessed by .GetWasmService in the templates.
func NewWasmService ¶
func NewWasmService(file *descriptorpb.FileDescriptorProto, service *descriptorpb.ServiceDescriptorProto, lang LanguageText, finder Finder) *WasmService
func (*WasmService) AddImportsNeeded ¶
func (s *WasmService) AddImportsNeeded(imp map[string]struct{})
func (*WasmService) Collect ¶
func (s *WasmService) Collect()
func (*WasmService) Finder ¶
func (w *WasmService) Finder() Finder
func (*WasmService) GetGoPackage ¶
func (w *WasmService) GetGoPackage() string
func (*WasmService) GetLanguage ¶
func (w *WasmService) GetLanguage() LanguageText
func (*WasmService) GetParent ¶
func (s *WasmService) GetParent() *descriptorpb.FileDescriptorProto
GetParent returns the parent of this wasm service, which is a descriptor for the file containing it.
func (*WasmService) GetProtoPackage ¶
func (w *WasmService) GetProtoPackage() string
func (*WasmService) GetWasmMethod ¶
func (s *WasmService) GetWasmMethod() []*WasmMethod
GetWasmMethod returns all the wasm methods contained inside this service.
func (*WasmService) GetWasmServiceErrId ¶
func (w *WasmService) GetWasmServiceErrId() string
GetWasmServiceErrId gets the string that is the type name of the return type of this service. It will be <serviceName>Err. It caches this value after it is computed the first time.
func (*WasmService) GetWasmServiceName ¶
func (w *WasmService) GetWasmServiceName() string
GetWasmServiceName looks through the data structure given that represents the original protobuf structure trying to fin constructs like this:
service Foo { option (parigot.wasm_service_name) = "foozie";
If no such construction is found, it returns the simple name.
func (*WasmService) ImplementsReverseAPI ¶
func (w *WasmService) ImplementsReverseAPI() string
func (*WasmService) IsWasmServiceReverseAPI ¶
func (w *WasmService) IsWasmServiceReverseAPI() bool
func (*WasmService) NoMethod ¶
func (s *WasmService) NoMethod() bool
NoMethod returns true if the length of the slice of Methods is zero.