cRpc

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Header_Rpc_App     = "Rpc-App"
	Header_Rpc_Service = "Rpc-Service"
	Header_Rpc_Method  = "Rpc-Method"
)

Variables

This section is empty.

Functions

func Call

func Call(ctx *gin.Context, client, method string, req, rsp interface{}) (err error)

func GetGinHandlerFunc

func GetGinHandlerFunc() gin.HandlerFunc

func GetService

func GetService(app, service string) interface{}

func Inject

func Inject(instance interface{})

func IsRpcService

func IsRpcService(instance interface{}) bool

func Load

func Load()

Types

type RpcClientContainer

type RpcClientContainer struct {
	Lock      *sync.Mutex
	Instances map[string]*RpcConf_Service
}

func (*RpcClientContainer) Get

func (i *RpcClientContainer) Get(client string) (host, app, service string, err error)

func (*RpcClientContainer) Save

func (i *RpcClientContainer) Save(client string, conf *RpcConf_Service)

type RpcClientInterface

type RpcClientInterface interface {
	RpcClientName() string
}

type RpcConf

type RpcConf struct {
	Services []*RpcConf_Service `json:"services"`
}

func (*RpcConf) ConfigName

func (i *RpcConf) ConfigName() string

type RpcConf_Service

type RpcConf_Service struct {
	Client  string `json:"client"`
	Host    string `json:"host"`
	App     string `json:"app"`
	Service string `json:"service"`
}

type RpcContainer

type RpcContainer struct {
	Lock      *sync.Mutex
	Instances map[string]interface{}
}

func (*RpcContainer) Get

func (i *RpcContainer) Get(app, service string) interface{}

func (*RpcContainer) Handler

func (i *RpcContainer) Handler(ctx *gin.Context) (int, interface{})

func (*RpcContainer) Save

func (i *RpcContainer) Save(instance interface{})

type RpcController

type RpcController struct {
}

func (*RpcController) ControllerName

func (c *RpcController) ControllerName() string

type RpcServiceInterface

type RpcServiceInterface interface {
	RpcServiceName() (string, string)
}

Jump to

Keyboard shortcuts

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