|
|
@ -9,10 +9,8 @@ It is generated from these files: |
|
|
|
supplier.proto |
|
|
|
|
|
|
|
It has these top-level messages: |
|
|
|
GetRequest |
|
|
|
GetUuidRequest |
|
|
|
GetResponse |
|
|
|
BoolResponse |
|
|
|
Request |
|
|
|
Response |
|
|
|
*/ |
|
|
|
package supplierrpc |
|
|
|
|
|
|
@ -30,104 +28,88 @@ import protorpc "github.com/chai2010/protorpc" |
|
|
|
var _ = proto.Marshal |
|
|
|
var _ = math.Inf |
|
|
|
|
|
|
|
// 使用key查询
|
|
|
|
type GetRequest struct { |
|
|
|
Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"` |
|
|
|
Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` |
|
|
|
// 配置信息请求结构
|
|
|
|
type Request 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 *GetRequest) Reset() { *m = GetRequest{} } |
|
|
|
func (m *GetRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*GetRequest) ProtoMessage() {} |
|
|
|
func (m *Request) Reset() { *m = Request{} } |
|
|
|
func (m *Request) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*Request) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *GetRequest) GetDbname() string { |
|
|
|
if m != nil && m.Dbname != nil { |
|
|
|
return *m.Dbname |
|
|
|
func (m *Request) GetData() string { |
|
|
|
if m != nil && m.Data != nil { |
|
|
|
return *m.Data |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *GetRequest) GetId() string { |
|
|
|
if m != nil && m.Id != nil { |
|
|
|
return *m.Id |
|
|
|
func (m *Request) GetTime() string { |
|
|
|
if m != nil && m.Time != nil { |
|
|
|
return *m.Time |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
type GetUuidRequest struct { |
|
|
|
Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"` |
|
|
|
Uuid *string `protobuf:"bytes,2,opt,name=uuid" json:"uuid,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
} |
|
|
|
|
|
|
|
func (m *GetUuidRequest) Reset() { *m = GetUuidRequest{} } |
|
|
|
func (m *GetUuidRequest) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*GetUuidRequest) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *GetUuidRequest) GetDbname() string { |
|
|
|
if m != nil && m.Dbname != nil { |
|
|
|
return *m.Dbname |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *GetUuidRequest) GetUuid() string { |
|
|
|
if m != nil && m.Uuid != nil { |
|
|
|
return *m.Uuid |
|
|
|
func (m *Request) GetSign() string { |
|
|
|
if m != nil && m.Sign != nil { |
|
|
|
return *m.Sign |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// 使用key查询响应结构
|
|
|
|
type GetResponse struct { |
|
|
|
Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
// 配置信息响应结构
|
|
|
|
type Response 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 *GetResponse) Reset() { *m = GetResponse{} } |
|
|
|
func (m *GetResponse) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*GetResponse) ProtoMessage() {} |
|
|
|
func (m *Response) Reset() { *m = Response{} } |
|
|
|
func (m *Response) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*Response) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *GetResponse) GetValue() []byte { |
|
|
|
if m != nil { |
|
|
|
return m.Value |
|
|
|
func (m *Response) GetData() string { |
|
|
|
if m != nil && m.Data != nil { |
|
|
|
return *m.Data |
|
|
|
} |
|
|
|
return nil |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
// 使用key查询响应结构
|
|
|
|
type BoolResponse struct { |
|
|
|
Value *bool `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` |
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
func (m *Response) GetTime() string { |
|
|
|
if m != nil && m.Time != nil { |
|
|
|
return *m.Time |
|
|
|
} |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func (m *BoolResponse) Reset() { *m = BoolResponse{} } |
|
|
|
func (m *BoolResponse) String() string { return proto.CompactTextString(m) } |
|
|
|
func (*BoolResponse) ProtoMessage() {} |
|
|
|
|
|
|
|
func (m *BoolResponse) GetValue() bool { |
|
|
|
if m != nil && m.Value != nil { |
|
|
|
return *m.Value |
|
|
|
func (m *Response) GetSign() string { |
|
|
|
if m != nil && m.Sign != nil { |
|
|
|
return *m.Sign |
|
|
|
} |
|
|
|
return false |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func init() { |
|
|
|
} |
|
|
|
|
|
|
|
type ProductService interface { |
|
|
|
Get(in *GetRequest, out *GetResponse) error |
|
|
|
GetByUuid(in *GetUuidRequest, out *GetResponse) error |
|
|
|
IsOpen(in *GetRequest, out *BoolResponse) error |
|
|
|
type SupplierService interface { |
|
|
|
Get(in *Request, out *Response) error |
|
|
|
GetByUuid(in *Request, out *Response) error |
|
|
|
IsOpen(in *Request, out *Response) error |
|
|
|
Get380Star(in *Request, out *Response) error |
|
|
|
} |
|
|
|
|
|
|
|
// AcceptProductServiceClient accepts connections on the listener and serves requests
|
|
|
|
// 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 AcceptProductServiceClient(lis net.Listener, x ProductService) { |
|
|
|
func AcceptSupplierServiceClient(lis net.Listener, x SupplierService) { |
|
|
|
srv := rpc.NewServer() |
|
|
|
if err := srv.RegisterName("ProductService", x); err != nil { |
|
|
|
if err := srv.RegisterName("SupplierService", x); err != nil { |
|
|
|
log.Fatal(err) |
|
|
|
} |
|
|
|
|
|
|
@ -140,26 +122,26 @@ func AcceptProductServiceClient(lis net.Listener, x ProductService) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// RegisterProductService publish the given ProductService implementation on the server.
|
|
|
|
func RegisterProductService(srv *rpc.Server, x ProductService) error { |
|
|
|
if err := srv.RegisterName("ProductService", x); err != nil { |
|
|
|
// 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 |
|
|
|
} |
|
|
|
|
|
|
|
// NewProductServiceServer returns a new ProductService Server.
|
|
|
|
func NewProductServiceServer(x ProductService) *rpc.Server { |
|
|
|
// NewSupplierServiceServer returns a new SupplierService Server.
|
|
|
|
func NewSupplierServiceServer(x SupplierService) *rpc.Server { |
|
|
|
srv := rpc.NewServer() |
|
|
|
if err := srv.RegisterName("ProductService", x); err != nil { |
|
|
|
if err := srv.RegisterName("SupplierService", x); err != nil { |
|
|
|
log.Fatal(err) |
|
|
|
} |
|
|
|
return srv |
|
|
|
} |
|
|
|
|
|
|
|
// ListenAndServeProductService listen announces on the local network address laddr
|
|
|
|
// and serves the given ProductService implementation.
|
|
|
|
func ListenAndServeProductService(network, addr string, x ProductService) error { |
|
|
|
// 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 |
|
|
@ -167,7 +149,7 @@ func ListenAndServeProductService(network, addr string, x ProductService) error |
|
|
|
defer lis.Close() |
|
|
|
|
|
|
|
srv := rpc.NewServer() |
|
|
|
if err := srv.RegisterName("ProductService", x); err != nil { |
|
|
|
if err := srv.RegisterName("SupplierService", x); err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
@ -180,42 +162,45 @@ func ListenAndServeProductService(network, addr string, x ProductService) error |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
type ProductServiceClient struct { |
|
|
|
type SupplierServiceClient struct { |
|
|
|
*rpc.Client |
|
|
|
} |
|
|
|
|
|
|
|
// NewProductServiceClient returns a ProductService rpc.Client and stub to handle
|
|
|
|
// requests to the set of ProductService at the other end of the connection.
|
|
|
|
func NewProductServiceClient(conn io.ReadWriteCloser) (*ProductServiceClient, *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 &ProductServiceClient{c}, c |
|
|
|
return &SupplierServiceClient{c}, c |
|
|
|
} |
|
|
|
|
|
|
|
func (c *ProductServiceClient) Get(in *GetRequest, out *GetResponse) error { |
|
|
|
return c.Call("ProductService.Get", in, out) |
|
|
|
func (c *SupplierServiceClient) Get(in *Request, out *Response) error { |
|
|
|
return c.Call("SupplierService.Get", in, out) |
|
|
|
} |
|
|
|
func (c *SupplierServiceClient) GetByUuid(in *Request, out *Response) error { |
|
|
|
return c.Call("SupplierService.GetByUuid", in, out) |
|
|
|
} |
|
|
|
func (c *ProductServiceClient) GetByUuid(in *GetUuidRequest, out *GetResponse) error { |
|
|
|
return c.Call("ProductService.GetByUuid", in, out) |
|
|
|
func (c *SupplierServiceClient) IsOpen(in *Request, out *Response) error { |
|
|
|
return c.Call("SupplierService.IsOpen", in, out) |
|
|
|
} |
|
|
|
func (c *ProductServiceClient) IsOpen(in *GetRequest, out *BoolResponse) error { |
|
|
|
return c.Call("ProductService.IsOpen", in, out) |
|
|
|
func (c *SupplierServiceClient) Get380Star(in *Request, out *Response) error { |
|
|
|
return c.Call("SupplierService.Get380Star", in, out) |
|
|
|
} |
|
|
|
|
|
|
|
// DialProductService connects to an ProductService at the specified network address.
|
|
|
|
func DialProductService(network, addr string) (*ProductServiceClient, *rpc.Client, error) { |
|
|
|
// 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 &ProductServiceClient{c}, c, nil |
|
|
|
return &SupplierServiceClient{c}, c, nil |
|
|
|
} |
|
|
|
|
|
|
|
// DialProductServiceTimeout connects to an ProductService at the specified network address.
|
|
|
|
func DialProductServiceTimeout(network, addr string, |
|
|
|
timeout time.Duration) (*ProductServiceClient, *rpc.Client, error) { |
|
|
|
// 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 &ProductServiceClient{c}, c, nil |
|
|
|
return &SupplierServiceClient{c}, c, nil |
|
|
|
} |