Documentation ¶
Index ¶
- Variables
- func Generate(file *protogen.File, protoPackagePath, connectPackagePath string, ...) error
- func GenerateOther(name, packageName string, out io.Writer) error
- func GenerateWithData(data *TemplateData, out io.Writer) error
- type TemplateData
- type TemplateFieldData
- type TemplateMethodData
- type TemplateRequestData
- type TemplateServiceData
Constants ¶
This section is empty.
Variables ¶
View Source
var ConvertTmpl []byte
View Source
var ServiceTmpl []byte
View Source
var Templates = map[string][]byte{ "Convert": ConvertTmpl, "Service": ServiceTmpl, "Types": TypesTmpl, }
View Source
var TypesTmpl []byte
Functions ¶
func Generate ¶
func Generate(file *protogen.File, protoPackagePath, connectPackagePath string, out io.Writer) error
Generate generates a go code to connect OpenAPI interface with connect service methods.
func GenerateWithData ¶
func GenerateWithData(data *TemplateData, out io.Writer) error
Types ¶
type TemplateData ¶
type TemplateData struct { PackageName string ProtoPackagePath string ConnectPackagePath string Services []TemplateServiceData }
func (*TemplateData) FixOrders ¶
func (d *TemplateData) FixOrders()
FixOrders fixes the order of Services by its Name
type TemplateFieldData ¶
type TemplateFieldData struct { // Name is name used in proto file Name string // GoName is name used in Go code GoName string // GoType is type used in Go code GoType string // ParamType is where the field is located // "query", "path" or "body" ParamType string // Repeated is true if the field is allowed multiple values Repeated bool // Optional is true if the field is optional Optional bool }
type TemplateMethodData ¶
type TemplateMethodData struct { Name string HTTPMethod string HTTPPath string Request TemplateRequestData }
type TemplateRequestData ¶
type TemplateRequestData struct { Name string ExpectBody bool Fields []TemplateFieldData }
TempalteRequestData is a data for proto request message
func (*TemplateRequestData) FixOrders ¶
func (d *TemplateRequestData) FixOrders()
FixOrders fixes the order of Fields by its Name
type TemplateServiceData ¶
type TemplateServiceData struct { Name string // Endpoints []TemplateEndpointData Methods []TemplateMethodData }
func (*TemplateServiceData) FixOrders ¶
func (d *TemplateServiceData) FixOrders()
FixOrders fixes the order of Methods by its Name
Click to show internal directories.
Click to hide internal directories.