gen

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadHandlerTemplate

func LoadHandlerTemplate(fname string) (map[string]MethodHandler, error)

func LoadMiddlewareTemplate

func LoadMiddlewareTemplate(fname string) (map[string]MethodHandler, error)

Types

type Config

type Config struct {
	Out                *string
	Template           *string
	HandlerTemplate    *string
	MiddlewareTemplate *string

	Global      MethodHandler
	Handlers    map[string]MethodHandler
	Middlewares map[string]MethodHandler
	HandleField func(field *protogen.Field, prop *spec.Schema) bool
}

type Generator

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

func NewGenerator

func NewGenerator(conf *Config, doc *spec.Swagger) *Generator

func (*Generator) Document added in v0.1.1

func (g *Generator) Document() *spec.Swagger

func (*Generator) Run

func (g *Generator) Run(plugin *protogen.Plugin) error

type HandlerTemplate

type HandlerTemplate struct {
	Consumes   []string         `json:"consumes"`
	Produces   []string         `json:"produces"`
	Parameters []spec.Parameter `json:"parameters"`
	Responses  *spec.Responses  `json:"responses"`
}

func (*HandlerTemplate) Handle

func (ht *HandlerTemplate) Handle(method *protogen.Method, annotations annotations.Annotations, operation *spec.Operation)

type MethodHandler

type MethodHandler func(method *protogen.Method, annotations annotations.Annotations, operation *spec.Operation)

type MiddlewareTemplate

type MiddlewareTemplate struct {
	Parameters []spec.Parameter      `json:"parameters"`
	Security   []map[string][]string `json:"security"`
	Responses  *spec.Responses       `json:"responses"`
}

func (*MiddlewareTemplate) Handle

func (mt *MiddlewareTemplate) Handle(method *protogen.Method, annotations annotations.Annotations, operation *spec.Operation)

Jump to

Keyboard shortcuts

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