1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-24 08:02:32 +02:00
go-micro/client/client.go
2015-05-21 19:24:57 +01:00

44 lines
1.1 KiB
Go

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(Request, interface{}) error
CallRemote(string, string, Request, interface{}) error
}
type options struct {
transport transport.Transport
}
type Options func(*options)
var (
DefaultClient Client = NewRpcClient()
)
func Call(request Request, response interface{}) error {
return DefaultClient.Call(request, response)
}
func CallRemote(address, path string, request Request, response interface{}) error {
return DefaultClient.CallRemote(address, path, request, response)
}
func NewRequest(service, method string, request interface{}) Request {
return DefaultClient.NewRequest(service, method, request)
}
func NewProtoRequest(service, method string, request interface{}) Request {
return DefaultClient.NewProtoRequest(service, method, request)
}
func NewJsonRequest(service, method string, request interface{}) Request {
return DefaultClient.NewJsonRequest(service, method, request)
}