rpc_client

package
v0.0.0-...-3a05b22 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "rpc-client"

Variables

This section is empty.

Functions

func GetImpl

func GetImpl(key string, param *Param) (interface{}, error)

GetImpl returns impl ptr of rpc client, key should has lowercase character prefix, and 'IOCRPCClient' suffix like 'github.com/cc-cheunggg/ioc-golang/example/autowire/autowire_rpc/client/test/service/api.SimpleServiceIOCRPCClient'

The returned interface is proxy struct pointer like pointer of 'github.com/cc-cheunggg/ioc-golang/example/autowire/autowire_rpc/client/test/service/api.simpleServiceIOCRPCClient_'

The returned interface can be asserted to ioc rpc client interface like 'github.com/cc-cheunggg/ioc-golang/example/autowire/autowire_rpc/client/test/service/api.SimpleServiceIOCRPCClient'

An example to use this API is : ```go simpleClient, err := rpc_client.GetImpl("github.com/cc-cheunggg/ioc-golang/example/autowire/autowire_rpc/client/test/service/api.SimpleServiceIOCRPCClient", param)

if err != nil{
    panic(err)
}

usr, err := simpleClient.(api.SimpleServiceIOCRPCClient).GetUser("laurence", 23) ```

func ImplClientStub

func ImplClientStub(clientStubPtr interface{}, param *Param) (interface{}, error)

ImplClientStub returns impl ptr of rpc client, clientStubPtr should be a generated ioc rpc interface client ptr like 'github.com/cc-cheunggg/ioc-golang/example/autowire/autowire_rpc/client/test/service/api.SimpleServiceIOCRPCClient'

new(simpleServiceIOCRPCClient)

The returned interface is proxy struct pointer like pointer of 'github.com/cc-cheunggg/ioc-golang/example/autowire/autowire_rpc/client/test/service/api.simpleServiceIOCRPCClient_'

The returned interface can be asserted to ioc rpc client interface like 'github.com/cc-cheunggg/ioc-golang/example/autowire/autowire_rpc/client/test/service/api.SimpleServiceIOCRPCClient'

An example to use this API is : ```go import(

"github.com/cc-cheunggg/ioc-golang/example/autowire/autowire_rpc/client/test/service/api"

)

simpleClient, err := rpc_client.ImplClientStub(new(api.SimpleServiceIOCRPCClient), param)

if err != nil{
    panic(err)
}

usr, err := simpleClient.(api.SimpleServiceIOCRPCClient).GetUser("laurence", 23) ```

func RegisterStructDescriptor

func RegisterStructDescriptor(s *autowire.StructDescriptor)

Types

type Autowire

type Autowire struct {
	autowire.Autowire
}

func (*Autowire) GetAllStructDescriptors

func (a *Autowire) GetAllStructDescriptors() map[string]*autowire.StructDescriptor

GetAllStructDescriptors re-write SingletonAutowire

func (*Autowire) TagKey

func (a *Autowire) TagKey() string

type Param

type Param struct {
	Address string
	Timeout string
}

Jump to

Keyboard shortcuts

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