further transport rework
This commit is contained in:
@@ -1,33 +1,43 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/myodc/go-micro/transport"
|
||||
)
|
||||
|
||||
type Client interface {
|
||||
NewRequest(string, string, interface{}) Request
|
||||
NewProtoRequest(string, string, interface{}) Request
|
||||
NewJsonRequest(string, string, interface{}) Request
|
||||
Call(interface{}, interface{}) error
|
||||
CallRemote(string, string, interface{}, interface{}) error
|
||||
Call(Request, interface{}) error
|
||||
CallRemote(string, string, Request, interface{}) error
|
||||
}
|
||||
|
||||
type options struct {
|
||||
transport transport.Transport
|
||||
}
|
||||
|
||||
type Options func(*options)
|
||||
|
||||
var (
|
||||
client = NewRpcClient()
|
||||
DefaultClient Client = NewRpcClient()
|
||||
)
|
||||
|
||||
func Call(request Request, response interface{}) error {
|
||||
return client.Call(request, response)
|
||||
return DefaultClient.Call(request, response)
|
||||
}
|
||||
|
||||
func CallRemote(address, path string, request Request, response interface{}) error {
|
||||
return client.CallRemote(address, path, request, response)
|
||||
return DefaultClient.CallRemote(address, path, request, response)
|
||||
}
|
||||
|
||||
func NewRequest(service, method string, request interface{}) Request {
|
||||
return client.NewRequest(service, method, request)
|
||||
return DefaultClient.NewRequest(service, method, request)
|
||||
}
|
||||
|
||||
func NewProtoRequest(service, method string, request interface{}) Request {
|
||||
return client.NewProtoRequest(service, method, request)
|
||||
return DefaultClient.NewProtoRequest(service, method, request)
|
||||
}
|
||||
|
||||
func NewJsonRequest(service, method string, request interface{}) Request {
|
||||
return client.NewJsonRequest(service, method, request)
|
||||
return DefaultClient.NewJsonRequest(service, method, request)
|
||||
}
|
||||
|
Reference in New Issue
Block a user