genpjrpc

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Package genpjrpc is a generator JSON-RPC methods by proto spec.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version of the generator.
	Version = "(unknown)"
	// MethodsWithServiceName specifies that name of methods will be generate with service name.
	MethodsWithServiceName = false

	// GenerateClient true flag will generate the client code for json-rpc service.
	GenerateClient = true
	// GenerateServer true flag will generate the server code for json-rpc service.
	GenerateServer = true
)

Some variables as config of generator.

Functions

func GenerateFile

func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile

GenerateFile generates golang file with JSON-RPC methods.

Types

type MethodInfo

type MethodInfo struct {
	Method         *protogen.Method // Origin protogen type.
	Name           string           // GoName of the method.
	ConstName      string           // Name of the constant with RPC method name.
	RPCName        string           // Method name in snake_case may be with service name.
	RegHandlerName string           // Name of the handler for registration method in router.
}

MethodInfo is a protogen.Method with names for JSON-RPC router.

type ServiceInfo

type ServiceInfo struct {
	Service *protogen.Service // Origin protogen type.
	Name    string            // GoName of service.
	Methods []*MethodInfo     // Methods list.
}

ServiceInfo is a protogen.Service with JSON-RPC methods.

func GetServiceInfo

func GetServiceInfo(s *protogen.Service) *ServiceInfo

GetServiceInfo transforms protogen types with names for JSON-RPC router.

Jump to

Keyboard shortcuts

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