generator

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileType

type FileType = string
const (
	FILETYPE_STRUCT FileType = "structs"
	FILETYPE_ALIAS  FileType = "aliases"

	FILETYPE_SERVICE FileType = "services"
	FILETYPE_SERVER  FileType = "servers"

	FILETYPE_ERROR FileType = "errors"
)

type Generator

type Generator struct {
	Spec            *spec.Spec
	PkgPath         string
	PkgName         string
	SrcModPath      string
	BaseImportPath  string
	ServerGenerator ServerGeneratorInterface

	Files map[FileType]*jen.File
}

func (*Generator) Run

func (g *Generator) Run()

type ServerGenerator

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

type ServerGeneratorInterface

type ServerGeneratorInterface interface {
	GetContextParameter() jen.Code
	WriteRegisterRoutes(name string, service *spec.ServiceSpec) jen.Code
	WriteHandlerFunctionStub(handleType string, endpointName string, endpoint *spec.Endpoint) jen.Code
	WriteErrReturn(code int, errName string) jen.Code
	WriteErrReturnWithJenCode(code int, jc jen.Code) jen.Code
	WriteJsonReturn(valueName string) jen.Code
	WriteBinaryReturn(valueName string) jen.Code
	WriteStatusCodeReturn() jen.Code
	WriteCookieReader(varName string, cookieName string) jen.Code
	WriteHeaderReader(varName string, headerName string) jen.Code

	WritePathParamReader(varName string, argName string) jen.Code
	WriteQueryParamReader(varName string, argName string) jen.Code
	WriteQueryParamArrayReader(varName string, ty types.TypeInterface) jen.Code
	WriteBodyReader(varName string, ty types.TypeInterface) jen.Code
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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