cRpc

package module
v0.0.160 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(ctx *gin.Context, client RpcClientInterface, 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 InjectConf added in v0.0.52

func InjectConf(conf interface{})

func IsRpcService

func IsRpcService(instance interface{}) bool

func Load

func Load()

Types

type RpcClientContainer

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

func (*RpcClientContainer) GetHost added in v0.0.5

func (i *RpcClientContainer) GetHost(app, service string) string

func (*RpcClientContainer) Save

func (i *RpcClientContainer) Save(client *RpcConf_Client)

type RpcClientInterface

type RpcClientInterface interface {
	RpcClientName() (app string, service string)
}

type RpcConf

type RpcConf struct {
	RequestURI string            `json:"request_uri"`
	Clients    []*RpcConf_Client `json:"clients"`
}

func GetRpcConf added in v0.0.52

func GetRpcConf() *RpcConf

func (*RpcConf) ConfigName

func (i *RpcConf) ConfigName() string

type RpcConf_Client added in v0.0.6

type RpcConf_Client struct {
	Host     string                    `json:"host"`
	Services []*RpcConf_Client_Service `json:"services"`
}

type RpcConf_Client_Service added in v0.0.6

type RpcConf_Client_Service struct {
	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) Save

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

type RpcController

type RpcController struct {
}

func (*RpcController) ControllerName

func (c *RpcController) ControllerName() (app, name string)

func (*RpcController) Handler added in v0.0.12

func (c *RpcController) Handler(ctx *gin.Context) (int, interface{})

type RpcServiceInterface

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

Jump to

Keyboard shortcuts

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