Version: v1.1.0 Latest Latest

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

Go to latest
Published: Jun 8, 2021 License: MIT Imports: 5 Imported by: 2



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



This section is empty.


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.


func GenerateFile

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

GenerateFile generates golang file with JSON-RPC methods.


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