// Code generated by protoc-gen-go.
|
|
// source: order.proto
|
|
// DO NOT EDIT!
|
|
|
|
/*
|
|
Package orderrpcv2 is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
order.proto
|
|
|
|
It has these top-level messages:
|
|
Request
|
|
Response
|
|
*/
|
|
package orderrpcv2
|
|
|
|
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 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 *Request) Reset() { *m = Request{} }
|
|
func (m *Request) String() string { return proto.CompactTextString(m) }
|
|
func (*Request) ProtoMessage() {}
|
|
|
|
func (m *Request) GetData() string {
|
|
if m != nil && m.Data != nil {
|
|
return *m.Data
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *Request) GetTime() string {
|
|
if m != nil && m.Time != nil {
|
|
return *m.Time
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *Request) GetSign() string {
|
|
if m != nil && m.Sign != nil {
|
|
return *m.Sign
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// 响应结构
|
|
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 *Response) Reset() { *m = Response{} }
|
|
func (m *Response) String() string { return proto.CompactTextString(m) }
|
|
func (*Response) ProtoMessage() {}
|
|
|
|
func (m *Response) GetData() string {
|
|
if m != nil && m.Data != nil {
|
|
return *m.Data
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *Response) GetTime() string {
|
|
if m != nil && m.Time != nil {
|
|
return *m.Time
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *Response) GetSign() string {
|
|
if m != nil && m.Sign != nil {
|
|
return *m.Sign
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func init() {
|
|
}
|
|
|
|
type OrderService interface {
|
|
Create(in *Request, out *Response) error
|
|
CreateByCart(in *Request, out *Response) error
|
|
Cancel(in *Request, out *Response) error
|
|
AutoReceive(in *Request, out *Response) error
|
|
Get(in *Request, out *Response) error
|
|
}
|
|
|
|
// AcceptOrderServiceClient accepts connections on the listener and serves requests
|
|
// for each incoming connection. Accept blocks; the caller typically
|
|
// invokes it in a go statement.
|
|
func AcceptOrderServiceClient(lis net.Listener, x OrderService) {
|
|
srv := rpc.NewServer()
|
|
if err := srv.RegisterName("OrderService", 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))
|
|
}
|
|
}
|
|
|
|
// RegisterOrderService publish the given OrderService implementation on the server.
|
|
func RegisterOrderService(srv *rpc.Server, x OrderService) error {
|
|
if err := srv.RegisterName("OrderService", x); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// NewOrderServiceServer returns a new OrderService Server.
|
|
func NewOrderServiceServer(x OrderService) *rpc.Server {
|
|
srv := rpc.NewServer()
|
|
if err := srv.RegisterName("OrderService", x); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
return srv
|
|
}
|
|
|
|
// ListenAndServeOrderService listen announces on the local network address laddr
|
|
// and serves the given OrderService implementation.
|
|
func ListenAndServeOrderService(network, addr string, x OrderService) error {
|
|
lis, err := net.Listen(network, addr)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer lis.Close()
|
|
|
|
srv := rpc.NewServer()
|
|
if err := srv.RegisterName("OrderService", 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 OrderServiceClient struct {
|
|
*rpc.Client
|
|
}
|
|
|
|
// NewOrderServiceClient returns a OrderService rpc.Client and stub to handle
|
|
// requests to the set of OrderService at the other end of the connection.
|
|
func NewOrderServiceClient(conn io.ReadWriteCloser) (*OrderServiceClient, *rpc.Client) {
|
|
c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
|
|
return &OrderServiceClient{c}, c
|
|
}
|
|
|
|
func (c *OrderServiceClient) Create(in *Request, out *Response) error {
|
|
return c.Call("OrderService.Create", in, out)
|
|
}
|
|
func (c *OrderServiceClient) CreateByCart(in *Request, out *Response) error {
|
|
return c.Call("OrderService.CreateByCart", in, out)
|
|
}
|
|
func (c *OrderServiceClient) Cancel(in *Request, out *Response) error {
|
|
return c.Call("OrderService.Cancel", in, out)
|
|
}
|
|
func (c *OrderServiceClient) AutoReceive(in *Request, out *Response) error {
|
|
return c.Call("OrderService.AutoReceive", in, out)
|
|
}
|
|
func (c *OrderServiceClient) Get(in *Request, out *Response) error {
|
|
return c.Call("OrderService.Get", in, out)
|
|
}
|
|
|
|
// DialOrderService connects to an OrderService at the specified network address.
|
|
func DialOrderService(network, addr string) (*OrderServiceClient, *rpc.Client, error) {
|
|
c, err := protorpc.Dial(network, addr)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
return &OrderServiceClient{c}, c, nil
|
|
}
|
|
|
|
// DialOrderServiceTimeout connects to an OrderService at the specified network address.
|
|
func DialOrderServiceTimeout(network, addr string,
|
|
timeout time.Duration) (*OrderServiceClient, *rpc.Client, error) {
|
|
c, err := protorpc.DialTimeout(network, addr, timeout)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
return &OrderServiceClient{c}, c, nil
|
|
}
|