Documentation ¶
Index ¶
- Constants
- Variables
- func GRPCRequest[C any](ctx *gin.Context, client RpcClientInterface, ...) (rsp any, err error)
- func HTTPRequest(ctx *gin.Context, client RpcClientInterface, method string, req, rsp any) (err error)
- type ClientType
- type ParseHostFunc
- type RpcClientContainer
- func (i *RpcClientContainer) Get(name string) any
- func (i *RpcClientContainer) GetGRPCConnection(pkg, app, name string) grpc.ClientConnInterface
- func (i *RpcClientContainer) GetHost(pkg, app, name string) (host string)
- func (i *RpcClientContainer) Is(instance any) bool
- func (i *RpcClientContainer) Range(f func(instance any))
- func (i *RpcClientContainer) Remove(name string) bool
- func (i *RpcClientContainer) Save(instance any) bool
- type RpcClientInterface
- type RpcComponent
- type RpcConf
- type RpcConf_Client
- type RpcConf_Client_Service
- type RpcController
- type RpcServiceContainer
- type RpcServiceInterface
- type SignatureDecryptFunc
- type SignatureEncryptFunc
Constants ¶
View Source
const ( RpcConfigName string = "RpcConf" GRPCClient ClientType = "grpc" HTTPClient ClientType = "http" HTTPRequestUri string = "/rpc/call" HTTPTimeout int64 = 60 HTTPTryTimes int64 = 3 )
Variables ¶
View Source
var Component = &RpcComponent{}
Functions ¶
func GRPCRequest ¶ added in v0.3.5
func GRPCRequest[C any](ctx *gin.Context, client RpcClientInterface, f func(cc grpc.ClientConnInterface) C, method string, req any) (rsp any, err error)
func HTTPRequest ¶ added in v0.3.5
Types ¶
type ClientType ¶ added in v0.3.2
type ClientType string
type ParseHostFunc ¶ added in v0.0.52
type RpcClientContainer ¶
type RpcClientContainer struct {
// contains filtered or unexported fields
}
func (*RpcClientContainer) Get ¶
func (i *RpcClientContainer) Get(name string) any
func (*RpcClientContainer) GetGRPCConnection ¶ added in v0.4.0
func (i *RpcClientContainer) GetGRPCConnection(pkg, app, name string) grpc.ClientConnInterface
func (*RpcClientContainer) GetHost ¶ added in v0.0.5
func (i *RpcClientContainer) GetHost(pkg, app, name string) (host string)
func (*RpcClientContainer) Is ¶ added in v0.4.0
func (i *RpcClientContainer) Is(instance any) bool
func (*RpcClientContainer) Range ¶ added in v0.4.0
func (i *RpcClientContainer) Range(f func(instance any))
func (*RpcClientContainer) Remove ¶ added in v0.4.0
func (i *RpcClientContainer) Remove(name string) bool
func (*RpcClientContainer) Save ¶
func (i *RpcClientContainer) Save(instance any) bool
type RpcClientInterface ¶
type RpcClientInterface interface {
RpcClientName() (pkg, app, service string)
}
type RpcComponent ¶ added in v0.3.9
type RpcComponent struct{}
func (*RpcComponent) Inject ¶ added in v0.3.9
func (i *RpcComponent) Inject(instance any) bool
func (*RpcComponent) InjectConf ¶ added in v0.4.0
func (i *RpcComponent) InjectConf(config cComponents.ConfigInterface) bool
func (*RpcComponent) Listen ¶ added in v0.4.0
func (i *RpcComponent) Listen() []*cComponents.ConfigListener
func (*RpcComponent) Load ¶ added in v0.3.9
func (i *RpcComponent) Load()
type RpcConf ¶
type RpcConf struct { RequestURI string `json:"request_uri"` Timeout int64 `json:"timeout"` Try int64 `json:"try"` Signature string `json:"signature"` Clients []*RpcConf_Client `json:"clients"` HostFunc ParseHostFunc `json:"-"` SignEncryptFunc SignatureEncryptFunc `json:"-"` SignDecryptFunc SignatureDecryptFunc `json:"-"` }
func (*RpcConf) ConfigName ¶
func (*RpcConf) SetHostFunc ¶ added in v0.4.0
func (i *RpcConf) SetHostFunc(f ParseHostFunc)
func (*RpcConf) SetSignDecryptFunc ¶ added in v0.4.0
func (i *RpcConf) SetSignDecryptFunc(f SignatureDecryptFunc)
func (*RpcConf) SetSignEncryptFunc ¶ added in v0.4.0
func (i *RpcConf) SetSignEncryptFunc(f SignatureEncryptFunc)
type RpcConf_Client ¶ added in v0.0.6
type RpcConf_Client struct { Type ClientType `json:"type"` Host string `json:"host"` Package string `json:"package"` Services []*RpcConf_Client_Service `json:"services"` }
type RpcConf_Client_Service ¶ added in v0.0.6
type RpcController ¶
type RpcController struct{}
func (*RpcController) ControllerName ¶
func (i *RpcController) ControllerName() (app, name string)
type RpcServiceContainer ¶ added in v0.4.0
type RpcServiceContainer struct {
// contains filtered or unexported fields
}
func (*RpcServiceContainer) Get ¶ added in v0.4.0
func (i *RpcServiceContainer) Get(name string) any
func (*RpcServiceContainer) Is ¶ added in v0.4.0
func (i *RpcServiceContainer) Is(instance any) bool
func (*RpcServiceContainer) Range ¶ added in v0.4.0
func (i *RpcServiceContainer) Range(f func(instance any))
func (*RpcServiceContainer) Remove ¶ added in v0.4.0
func (i *RpcServiceContainer) Remove(name string) bool
func (*RpcServiceContainer) Save ¶ added in v0.4.0
func (i *RpcServiceContainer) Save(instance any) bool
type RpcServiceInterface ¶
type RpcServiceInterface interface {
RpcServiceName() (app, service string)
}
type SignatureDecryptFunc ¶ added in v0.4.0
Click to show internal directories.
Click to hide internal directories.