Documentation ¶
Index ¶
- func Decrypt(f DecryptFunc)
- func Encrypt(f EncryptFunc)
- func GRPCRequest[C any](ctx *gin.Context, client RpcClientInterface, ...) (err error)
- func GetGrpcClient[C any](ctx *gin.Context, instance RpcClientInterface, ...) (client C, err error)
- func GetService(app, service string) interface{}
- func HTTPRequest(ctx *gin.Context, client RpcClientInterface, method string, ...) (err error)
- func Inject(instance interface{})
- func InjectConf(conf interface{})
- func IsRpcService(instance interface{}) bool
- func Load()
- func SetHostFunc(hostFunc ParseHostFunc)
- type ClientType
- type DecryptFunc
- type EncryptFunc
- type ParseHostFunc
- type RpcClientContainer
- func (i *RpcClientContainer) GetGrpcConn(pkg, app, service string) (conn grpc.ClientConnInterface, err error)
- func (i *RpcClientContainer) GetHost(pkg, app, service string) string
- func (i *RpcClientContainer) Save(client *RpcConf_Client)
- func (i *RpcClientContainer) SetEncrypt(f EncryptFunc)
- func (i *RpcClientContainer) SetHostFunc(hostFunc ParseHostFunc)
- func (i *RpcClientContainer) SetSignature(key string)
- type RpcClientInterface
- type RpcConf
- type RpcConf_Client
- type RpcConf_Client_Service
- type RpcContainer
- type RpcController
- type RpcServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶ added in v0.0.52
func Decrypt(f DecryptFunc)
func Encrypt ¶ added in v0.0.52
func Encrypt(f EncryptFunc)
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, rsp interface{}) (err error)
func GetGrpcClient ¶ added in v0.2.64
func GetGrpcClient[C any](ctx *gin.Context, instance RpcClientInterface, f func(cc grpc.ClientConnInterface) C) (client C, err error)
func GetService ¶
func GetService(app, service string) interface{}
func HTTPRequest ¶ added in v0.3.5
func HTTPRequest(ctx *gin.Context, client RpcClientInterface, method string, req, rsp interface{}) (err error)
func InjectConf ¶ added in v0.0.52
func InjectConf(conf interface{})
func IsRpcService ¶
func IsRpcService(instance interface{}) bool
func SetHostFunc ¶ added in v0.0.52
func SetHostFunc(hostFunc ParseHostFunc)
Types ¶
type ClientType ¶ added in v0.3.2
type ClientType string
const ( GRPCClient ClientType = "grpc" HTTPClient ClientType = "http" )
type DecryptFunc ¶ added in v0.0.52
type EncryptFunc ¶ added in v0.0.52
type ParseHostFunc ¶ added in v0.0.52
type RpcClientContainer ¶
type RpcClientContainer struct { Lock *sync.Mutex Signature string Hosts map[string]string HostFunc ParseHostFunc EncryptFunc EncryptFunc GrpcConn map[string]grpc.ClientConnInterface }
func (*RpcClientContainer) GetGrpcConn ¶ added in v0.2.64
func (i *RpcClientContainer) GetGrpcConn(pkg, app, service string) (conn grpc.ClientConnInterface, err error)
func (*RpcClientContainer) GetHost ¶ added in v0.0.5
func (i *RpcClientContainer) GetHost(pkg, app, service string) string
func (*RpcClientContainer) Save ¶
func (i *RpcClientContainer) Save(client *RpcConf_Client)
func (*RpcClientContainer) SetEncrypt ¶ added in v0.0.52
func (i *RpcClientContainer) SetEncrypt(f EncryptFunc)
func (*RpcClientContainer) SetHostFunc ¶ added in v0.0.52
func (i *RpcClientContainer) SetHostFunc(hostFunc ParseHostFunc)
func (*RpcClientContainer) SetSignature ¶ added in v0.0.52
func (i *RpcClientContainer) SetSignature(key string)
type RpcClientInterface ¶
type RpcClientInterface interface {
RpcClientName() (pkg, app, service string)
}
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"` }
func GetRpcConf ¶ added in v0.0.52
func GetRpcConf() *RpcConf
func (*RpcConf) ConfigName ¶
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 RpcContainer ¶
type RpcContainer struct { Lock *sync.Mutex DecryptFunc DecryptFunc Instances map[string]interface{} }
func (*RpcContainer) Get ¶
func (i *RpcContainer) Get(app, service string) interface{}
func (*RpcContainer) Save ¶
func (i *RpcContainer) Save(instance interface{})
func (*RpcContainer) SetDecrypt ¶ added in v0.0.52
func (i *RpcContainer) SetDecrypt(f DecryptFunc)
type RpcController ¶
type RpcController struct { }
func (*RpcController) ControllerName ¶
func (c *RpcController) ControllerName() (app, name string)
type RpcServiceInterface ¶
type RpcServiceInterface interface {
RpcServiceName() (app, service string)
}
Click to show internal directories.
Click to hide internal directories.