parser

package
v0.0.0-...-13bd48e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoBodyMethods = map[string]struct{}{
	http.MethodGet:     {},
	http.MethodHead:    {},
	http.MethodDelete:  {},
	http.MethodOptions: {},
}

Functions

func BuildAnnotations

func BuildAnnotations(g *protogen.GeneratedFile, m *protogen.Method, config *SwagParams) (string, error)

func ConvertGinToSwaggerPath

func ConvertGinToSwaggerPath(ginPath string) string

func FindProtoField

func FindProtoField(message *protogen.Message, keypath []string) *protogen.Field

func GinRoute

func GinRoute(protoPath string) (string, error)

func MethodCommend

func MethodCommend(m *protogen.Method) string

func ProtoKeyPath2GoKeyPath

func ProtoKeyPath2GoKeyPath(message *protogen.Message, keypath []string) []string

func ProtoTypeToGoType

func ProtoTypeToGoType(g *protogen.GeneratedFile, field *protogen.Field, usePtrForMessage bool) string

Types

type HeaderField

type HeaderField struct {
	Name  string
	Field *protogen.Field
}

func GinHeaderParams

func GinHeaderParams(m *protogen.Method) ([]HeaderField, error)

type HttpRule

type HttpRule struct {
	Path         string
	Method       string
	HasBody      bool
	Body         string
	ResponseBody string
}

func ParseHttpRule

func ParseHttpRule(rule *annotations.HttpRule) *HttpRule

type QueryFormField

type QueryFormField struct {
	Name  string
	Field *protogen.Field
}

func GinQueryForm

func GinQueryForm(m *protogen.Method, method string, pathVars []URIParamsField) ([]QueryFormField, error)

type SwagParams

type SwagParams struct {
	Method string
	Path   string
	Auth   string

	PathVars   []URIParamsField
	QueryVars  []QueryFormField
	HeaderVars []HeaderField

	Body         string
	ResponseBody string

	DataResponse  string
	ErrorResponse string
}

type URIParamsField

type URIParamsField struct {
	Name     string
	Wildcard bool
	Field    *protogen.Field
}

func GinURIParams

func GinURIParams(m *protogen.Method, route string) ([]URIParamsField, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL