grpcserver

package
v0.0.0-...-61578eb Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckGoVet

func CheckGoVet(filePath string) error

CheckGoVet to find errors not caught by the compiler.

func Execute

func Execute(serverData ServerData) error

Execute to generate code grpc server with flag.

func FormatSourceCode

func FormatSourceCode(source []byte) ([]byte, error)

FormatSourceCode to format code.

func WriteToFile

func WriteToFile(filePath string, buf []byte) error

WriteToFile to write byte data to filePath.

Types

type MethodInfo

type MethodInfo struct {
	Name         string
	RequestType  string
	ReturnType   string
	CommentLines []string
}

type ProtoExtractor

type ProtoExtractor interface {
	ExtractService(protoFilePath string) (Service, error)
}

func NewProtoExtractor

func NewProtoExtractor() ProtoExtractor

type ServerData

type ServerData struct {
	Services       []Service
	TemplateSource string
	RPCProtos      []string `name:"rpc_protos" help:"List services from rpc rpc or local folder" flag:"RPCProtos" default:"health/v1/service.proto"`
	EnableGateway  bool     `name:"enable_gateway" help:"Option to enable gateway" flag:"EnableGateway" default:"false"`
	OutputPath     string   `name:"output_path" help:"Goal path then generate" flag:"OutputPath" default:"z_server_grpc.go"`
	EnableMetric   bool     `name:"enable_metric" help:"Option to enable metric prometheus" flag:"EnableMetric" default:"true"`
	EnableHTTP     bool     `name:"enable_http" help:"Option expose port http" flag:"EnableHTTP" default:"true"`
	RPCProtoDir    string   `name:"rpc_proto_dir" help:"Folder contain list service" flag:"RPCProtoDir" default:"rpc-proto/proto"`
}

ServerData define flag of gen grpc server.

func NewServerData

func NewServerData(serverData ServerData) (ServerData, error)

NewServerData to return data use for template

type Service

type Service struct {
	ServiceAliasName string
	PackageName      string
	ServiceName      string
	ShortServiceName string
	Methods          []MethodInfo
}

Service ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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