codegen

package
v2.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Create = os.Create
View Source
var MkdirAll = os.MkdirAll
View Source
var Open = os.Open
View Source
var Stat = os.Stat

Functions

func FixModGrpc added in v2.0.9

func FixModGrpc(dir string)

FixModGrpc ...

func GenConfig

func GenConfig(dir string, ic astutils.InterfaceCollector)

GenConfig generates config file

func GenDb

func GenDb(dir string)

GenDb generates db connection code

func GenGoClient

func GenGoClient(dir string, ic astutils.InterfaceCollector, config GenGoClientConfig)

GenGoClient generates golang http client code from result of parsing svc.go file in project root path

func GenGoClientProxy

func GenGoClientProxy(dir string, ic astutils.InterfaceCollector)

GenGoClientProxy wraps client with resiliency features

func GenGoIClient

func GenGoIClient(dir string, ic astutils.InterfaceCollector)

GenGoIClient generates golang http client interface code from result of parsing svc.go file in project root path

func GenGrpcProto

func GenGrpcProto(dir string, ic astutils.InterfaceCollector, p protov3.ProtoGenerator) (service protov3.Service, protoFile string)

func GenHttp2Grpc added in v2.1.9

func GenHttp2Grpc(dir string, ic astutils.InterfaceCollector, config GenHttp2GrpcConfig)

GenHttp2Grpc generates http handler implementation Parsed value from query string parameters or application/x-www-form-urlencoded form will be string type. You may need to convert the type by yourself.

func GenHttpHandler

func GenHttpHandler(dir string, ic astutils.InterfaceCollector, routePatternStrategy int)

GenHttpHandler generates http handler interface and routes

func GenHttpHandlerImpl

func GenHttpHandlerImpl(dir string, ic astutils.InterfaceCollector, config GenHttpHandlerImplConfig)

GenHttpHandlerImpl generates http handler implementation Parsed value from query string parameters or application/x-www-form-urlencoded form will be string type. You may need to convert the type by yourself.

func GenHttpIntegrationTesting

func GenHttpIntegrationTesting(dir string, ic astutils.InterfaceCollector, postmanCollectionPath, dotenvPath string)

func GenHttpMiddleware

func GenHttpMiddleware(dir string)

GenHttpMiddleware generates http middleware file

func GenK8sDeployment

func GenK8sDeployment(dir string, svcname, image string)

GenK8sDeployment generates deployment kind yaml file for kubernetes deploy.

func GenK8sStatefulset

func GenK8sStatefulset(dir string, svcname, image string)

GenK8sStatefulset generates statefulset kind yaml file for kubernetes deploy

func GenMain

func GenMain(dir string, ic astutils.InterfaceCollector)

GenMain generates main function

func GenMainGrpc

func GenMainGrpc(dir string, ic astutils.InterfaceCollector, grpcSvc v3.Service)

GenMainGrpc generates main function for grpc service

func GenMainGrpcHttp added in v2.1.9

func GenMainGrpcHttp(dir string, ic astutils.InterfaceCollector, grpcSvc v3.Service)

GenMainGrpcHttp generates main function for grpc service

func GenMethodAnnotationStore

func GenMethodAnnotationStore(dir string, ic astutils.InterfaceCollector)

func GenSvcImpl

func GenSvcImpl(dir string, ic astutils.InterfaceCollector)

GenSvcImpl generates service implementation

func GenSvcImplGrpc

func GenSvcImplGrpc(dir string, ic astutils.InterfaceCollector, grpcSvc v3.Service)

GenSvcImplGrpc generates service implementation for grpc

func InitProj

func InitProj(conf InitProjConfig)

InitProj inits a service project dir is root path modName is module name

func InitSvc

func InitSvc(dir string)

InitSvc inits a service project, test purpose only

Types

type GenGoClientConfig added in v2.0.6

type GenGoClientConfig struct {
	Env                  string
	RoutePatternStrategy int
	AllowGetWithReqBody  bool
	CaseConvertor        func(string) string
}

type GenHttp2GrpcConfig added in v2.1.9

type GenHttp2GrpcConfig struct {
	AllowGetWithReqBody bool
}

type GenHttpHandlerImplConfig added in v2.0.6

type GenHttpHandlerImplConfig struct {
	Omitempty           bool
	AllowGetWithReqBody bool
	CaseConvertor       func(string) string
}

type InitProjConfig added in v2.1.6

type InitProjConfig struct {
	Dir            string
	ModName        string
	Runner         executils.Runner
	GenSvcGo       bool
	Module         bool
	ProtoGenerator v3.ProtoGenerator
	CaseConverter  func(string) string
	JsonCase       string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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