gen

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProtoJsonPackage               = protogen.GoImportPath("google.golang.org/protobuf/encoding/protojson")
	ProtoJsonMarshalOptionsIdent   = ProtoJsonPackage.Ident("MarshalOptions")
	ProtoJsonUnmarshalOptionsIdent = ProtoJsonPackage.Ident("UnmarshalOptions")
)
View Source
var (
	ContextPackage = protogen.GoImportPath("context")
	ContextIdent   = ContextPackage.Ident("Context")
)
View Source
var (
	HttpPackage          = protogen.GoImportPath("net/http")
	ClientIdent          = HttpPackage.Ident("Client")
	HttpHandlerIdent     = HttpPackage.Ident("Handler")
	HttpHandlerFuncIdent = HttpPackage.Ident("HandlerFunc")
	ResponseWriterIdent  = HttpPackage.Ident("ResponseWriter")
	RequestIdent         = HttpPackage.Ident("Request")
	ResponseIdent        = HttpPackage.Ident("Response")
)
View Source
var (
	FmtPackage   = protogen.GoImportPath("fmt")
	SprintfIdent = FmtPackage.Ident("Sprintf")
)
View Source
var (
	MuxPackage  = protogen.GoImportPath("github.com/gorilla/mux")
	RouterIdent = MuxPackage.Ident("Router")
	VarsIdent   = MuxPackage.Ident("Vars")
)
View Source
var (
	ProtoPackage     = protogen.GoImportPath("google.golang.org/protobuf/proto")
	ProtoStringIdent = ProtoPackage.Ident("String")
)
View Source
var (
	GorillaPackage               = protogen.GoImportPath("github.com/go-leo/gorilla")
	ErrorEncoderIdent            = GorillaPackage.Ident("ErrorEncoder")
	ResponseTransformerIdent     = GorillaPackage.Ident("ResponseTransformer")
	DefaultEncodeErrorIdent      = GorillaPackage.Ident("DefaultEncodeError")
	EncodeResponseIdent          = GorillaPackage.Ident("EncodeResponse")
	EncodeHttpBodyIdent          = GorillaPackage.Ident("EncodeHttpBody")
	EncodeHttpResponseIdent      = GorillaPackage.Ident("EncodeHttpResponse")
	DecodeRequestIdent           = GorillaPackage.Ident("DecodeRequest")
	DecodeHttpBodyIdent          = GorillaPackage.Ident("DecodeHttpBody")
	DecodeHttpRequestIdent       = GorillaPackage.Ident("DecodeHttpRequest")
	DecodeFormIdent              = GorillaPackage.Ident("DecodeForm")
	OptionIdent                  = GorillaPackage.Ident("Option")
	NewOptionsIdent              = GorillaPackage.Ident("NewOptions")
	ChainIdent                   = GorillaPackage.Ident("Chain")
	CustomDecodeRequestIdent     = GorillaPackage.Ident("CustomDecodeRequest")
	OnValidationErrCallbackIdent = GorillaPackage.Ident("OnValidationErrCallback")
	ValidateRequestIdent         = GorillaPackage.Ident("ValidateRequest")
)
View Source
var (
	WrapperspbPackage     = protogen.GoImportPath("google.golang.org/protobuf/types/known/wrapperspb")
	WrapperspbStringIdent = WrapperspbPackage.Ident("String")
)

Functions

func FieldGoType

func FieldGoType(g *protogen.GeneratedFile, field *protogen.Field) (goType []any, pointer bool)

FieldGoType returns the Go type used for a field.

If it returns pointer=true, the struct field is a pointer to the type.

func FindField

func FindField(name string, inMessage *protogen.Message) *protogen.Field

func FullFieldName

func FullFieldName(fields []*protogen.Field) string

Types

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

func (*Endpoint) Body

func (e *Endpoint) Body() string

func (*Endpoint) FullName

func (e *Endpoint) FullName() string

func (*Endpoint) HttpRule

func (e *Endpoint) HttpRule() *annotations.HttpRule

func (*Endpoint) Input

func (e *Endpoint) Input() *protogen.Message

func (*Endpoint) InputGoIdent

func (e *Endpoint) InputGoIdent() protogen.GoIdent

func (*Endpoint) IsStreaming

func (e *Endpoint) IsStreaming() bool

func (*Endpoint) Method

func (e *Endpoint) Method() string

func (*Endpoint) Name

func (e *Endpoint) Name() string

func (*Endpoint) Output

func (e *Endpoint) Output() *protogen.Message

func (*Endpoint) OutputGoIdent

func (e *Endpoint) OutputGoIdent() protogen.GoIdent

func (*Endpoint) ParseParameters

func (e *Endpoint) ParseParameters() (*protogen.Message, *protogen.Field, []*protogen.Field, []*protogen.Field, error)

func (*Endpoint) Path

func (e *Endpoint) Path() string

func (*Endpoint) PathParameters added in v1.0.1

func (e *Endpoint) PathParameters() ([]string, error)

func (*Endpoint) ResponseBody

func (e *Endpoint) ResponseBody() string

func (*Endpoint) Route

func (e *Endpoint) Route() *mux.Route

func (*Endpoint) SetHttpRule

func (e *Endpoint) SetHttpRule()

func (*Endpoint) SetRoute

func (e *Endpoint) SetRoute(route *mux.Route)

func (*Endpoint) Unexported

func (e *Endpoint) Unexported(s string) string

type Service

type Service struct {
	ProtoService *protogen.Service
	Endpoints    []*Endpoint
}

func NewServices

func NewServices(file *protogen.File) ([]*Service, error)

func (*Service) AppendRouteName

func (s *Service) AppendRouteName() string

func (*Service) FullName

func (s *Service) FullName() string

func (*Service) GorillaName

func (s *Service) GorillaName() string

func (*Service) HandlerName

func (s *Service) HandlerName() string

func (*Service) Name

func (s *Service) Name() string

func (*Service) RequestDecoderName

func (s *Service) RequestDecoderName() string

func (*Service) ResponseEncoderName

func (s *Service) ResponseEncoderName() string

func (*Service) ServiceName

func (s *Service) ServiceName() string

func (*Service) Unexported

func (s *Service) Unexported(name string) string

Jump to

Keyboard shortcuts

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