供应商rpc结构及公共方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
4.5 KiB

// Code generated by protoc-gen-go.
// source: supplier.proto
// DO NOT EDIT!
/*
Package supplierrpc is a generated protocol buffer package.
It is generated from these files:
supplier.proto
It has these top-level messages:
Params
*/
package supplierrpc
import proto "github.com/chai2010/protorpc/proto"
import math "math"
import "io"
import "log"
import "net"
import "net/rpc"
import "time"
import protorpc "github.com/chai2010/protorpc"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = math.Inf
type Params struct {
Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Params) Reset() { *m = Params{} }
func (m *Params) String() string { return proto.CompactTextString(m) }
func (*Params) ProtoMessage() {}
func (m *Params) GetData() string {
if m != nil && m.Data != nil {
return *m.Data
}
return ""
}
func (m *Params) GetTime() string {
if m != nil && m.Time != nil {
return *m.Time
}
return ""
}
func (m *Params) GetSign() string {
if m != nil && m.Sign != nil {
return *m.Sign
}
return ""
}
func init() {
}
type SupplierService interface {
Get(in *Params, out *Params) error
GetByUuid(in *Params, out *Params) error
IsOpen(in *Params, out *Params) error
}
// AcceptSupplierServiceClient accepts connections on the listener and serves requests
// for each incoming connection. Accept blocks; the caller typically
// invokes it in a go statement.
func AcceptSupplierServiceClient(lis net.Listener, x SupplierService) {
srv := rpc.NewServer()
if err := srv.RegisterName("SupplierService", x); err != nil {
log.Fatal(err)
}
for {
conn, err := lis.Accept()
if err != nil {
log.Fatalf("lis.Accept(): %v\n", err)
}
go srv.ServeCodec(protorpc.NewServerCodec(conn))
}
}
// RegisterSupplierService publish the given SupplierService implementation on the server.
func RegisterSupplierService(srv *rpc.Server, x SupplierService) error {
if err := srv.RegisterName("SupplierService", x); err != nil {
return err
}
return nil
}
// NewSupplierServiceServer returns a new SupplierService Server.
func NewSupplierServiceServer(x SupplierService) *rpc.Server {
srv := rpc.NewServer()
if err := srv.RegisterName("SupplierService", x); err != nil {
log.Fatal(err)
}
return srv
}
// ListenAndServeSupplierService listen announces on the local network address laddr
// and serves the given SupplierService implementation.
func ListenAndServeSupplierService(network, addr string, x SupplierService) error {
lis, err := net.Listen(network, addr)
if err != nil {
return err
}
defer lis.Close()
srv := rpc.NewServer()
if err := srv.RegisterName("SupplierService", x); err != nil {
return err
}
for {
conn, err := lis.Accept()
if err != nil {
log.Fatalf("lis.Accept(): %v\n", err)
}
go srv.ServeCodec(protorpc.NewServerCodec(conn))
}
}
type SupplierServiceClient struct {
*rpc.Client
}
// NewSupplierServiceClient returns a SupplierService rpc.Client and stub to handle
// requests to the set of SupplierService at the other end of the connection.
func NewSupplierServiceClient(conn io.ReadWriteCloser) (*SupplierServiceClient, *rpc.Client) {
c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
return &SupplierServiceClient{c}, c
}
func (c *SupplierServiceClient) Get(in *Params, out *Params) error {
return c.Call("SupplierService.Get", in, out)
}
func (c *SupplierServiceClient) GetByUuid(in *Params, out *Params) error {
return c.Call("SupplierService.GetByUuid", in, out)
}
func (c *SupplierServiceClient) IsOpen(in *Params, out *Params) error {
return c.Call("SupplierService.IsOpen", in, out)
}
// DialSupplierService connects to an SupplierService at the specified network address.
func DialSupplierService(network, addr string) (*SupplierServiceClient, *rpc.Client, error) {
c, err := protorpc.Dial(network, addr)
if err != nil {
return nil, nil, err
}
return &SupplierServiceClient{c}, c, nil
}
// DialSupplierServiceTimeout connects to an SupplierService at the specified network address.
func DialSupplierServiceTimeout(network, addr string,
timeout time.Duration) (*SupplierServiceClient, *rpc.Client, error) {
c, err := protorpc.DialTimeout(network, addr, timeout)
if err != nil {
return nil, nil, err
}
return &SupplierServiceClient{c}, c, nil
}