forked from micro/go-micro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
33 lines (26 loc) · 973 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package client
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
}
var (
client = NewRpcClient()
)
func Call(request Request, response interface{}) error {
return client.Call(request, response)
}
func CallRemote(address, path string, request Request, response interface{}) error {
return client.CallRemote(address, path, request, response)
}
func NewRequest(service, method string, request interface{}) Request {
return client.NewRequest(service, method, request)
}
func NewProtoRequest(service, method string, request interface{}) Request {
return client.NewProtoRequest(service, method, request)
}
func NewJsonRequest(service, method string, request interface{}) Request {
return client.NewJsonRequest(service, method, request)
}