genhandler

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PathsParamTypeImport         = "import"
	PathsParamTypeSourceRelative = "source_relative"
)

protobuf-v2 has an option to store generated pb near protofile (google.golang.org/protobuf@v1.27.1/compiler/protogen/protogen.go:432).

Variables

This section is empty.

Functions

func MustRegisterImplFileNameTemplate

func MustRegisterImplFileNameTemplate(tmpl string)

func MustRegisterImplTypeNameTemplate

func MustRegisterImplTypeNameTemplate(tmpl string)

Types

type Generator

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

func New

func New(reg *descriptor.Registry, opts ...Option) *Generator

New returns a new generator which generates handler wrappers.

func (*Generator) Generate

func (g *Generator) Generate(targets []*descriptor.File) ([]*plugin.CodeGeneratorResponse_File, error)

type Option

type Option func(*options)

func ApplyDefaultMiddlewares

func ApplyDefaultMiddlewares(apply bool) Option

ApplyDefaultMiddlewares toggles application of httpruntime/httpmw.DefaultChain to every generated handler.

func DescPath

func DescPath(path string) Option

DescPath sets path for description and swagger file

func Force

func Force(force bool) Option

Force sets force mode for generation implementation

func Impl

func Impl(impl bool) Option

Impl sets Impl flag option (if true implementation will be generated)

func ImplPath

func ImplPath(path string) Option

ImplPath sets path for implementation file

func PathsType

func PathsType(pathsParamType string) Option

PathsType is for compatibility with google.golang.org/protobuf (aka protobuf-v2).

func ServiceSubDir

func ServiceSubDir(subDir bool) Option

ServiceSubDir sets impl generation into sub directory

func SwaggerDef

func SwaggerDef(swaggerDef map[string][]byte) Option

SwaggerDef sets map of swagger.json per proto file

func SwaggerPath

func SwaggerPath(swaggerPath string) Option

SwaggerPath sets path to store separate swagger files

func WithTests

func WithTests(needTests bool) Option

WithTests sets if it needs for unit tests generation

Jump to

Keyboard shortcuts

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