// Code generated by protoc-gen-go. // source: coupon.proto // DO NOT EDIT! /* Package couponrpc is a generated protocol buffer package. It is generated from these files: coupon.proto It has these top-level messages: CouponRequest CouponResponse */ package couponrpc 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 CouponRequest 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 *CouponRequest) Reset() { *m = CouponRequest{} } func (m *CouponRequest) String() string { return proto.CompactTextString(m) } func (*CouponRequest) ProtoMessage() {} func (m *CouponRequest) GetData() string { if m != nil && m.Data != nil { return *m.Data } return "" } func (m *CouponRequest) GetTime() string { if m != nil && m.Time != nil { return *m.Time } return "" } func (m *CouponRequest) GetSign() string { if m != nil && m.Sign != nil { return *m.Sign } return "" } // 是否可用响应结构 type CouponResponse 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 *CouponResponse) Reset() { *m = CouponResponse{} } func (m *CouponResponse) String() string { return proto.CompactTextString(m) } func (*CouponResponse) ProtoMessage() {} func (m *CouponResponse) GetData() string { if m != nil && m.Data != nil { return *m.Data } return "" } func (m *CouponResponse) GetTime() string { if m != nil && m.Time != nil { return *m.Time } return "" } func (m *CouponResponse) GetSign() string { if m != nil && m.Sign != nil { return *m.Sign } return "" } func init() { } type CouponService interface { IsAvailable(in *CouponRequest, out *CouponResponse) error Use(in *CouponRequest, out *CouponResponse) error GetCouponInfo(in *CouponRequest, out *CouponResponse) error } // AcceptCouponServiceClient accepts connections on the listener and serves requests // for each incoming connection. Accept blocks; the caller typically // invokes it in a go statement. func AcceptCouponServiceClient(lis net.Listener, x CouponService) { srv := rpc.NewServer() if err := srv.RegisterName("CouponService", 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)) } } // RegisterCouponService publish the given CouponService implementation on the server. func RegisterCouponService(srv *rpc.Server, x CouponService) error { if err := srv.RegisterName("CouponService", x); err != nil { return err } return nil } // NewCouponServiceServer returns a new CouponService Server. func NewCouponServiceServer(x CouponService) *rpc.Server { srv := rpc.NewServer() if err := srv.RegisterName("CouponService", x); err != nil { log.Fatal(err) } return srv } // ListenAndServeCouponService listen announces on the local network address laddr // and serves the given CouponService implementation. func ListenAndServeCouponService(network, addr string, x CouponService) error { lis, err := net.Listen(network, addr) if err != nil { return err } defer lis.Close() srv := rpc.NewServer() if err := srv.RegisterName("CouponService", 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 CouponServiceClient struct { *rpc.Client } // NewCouponServiceClient returns a CouponService rpc.Client and stub to handle // requests to the set of CouponService at the other end of the connection. func NewCouponServiceClient(conn io.ReadWriteCloser) (*CouponServiceClient, *rpc.Client) { c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn)) return &CouponServiceClient{c}, c } func (c *CouponServiceClient) IsAvailable(in *CouponRequest, out *CouponResponse) error { return c.Call("CouponService.IsAvailable", in, out) } func (c *CouponServiceClient) Use(in *CouponRequest, out *CouponResponse) error { return c.Call("CouponService.Use", in, out) } func (c *CouponServiceClient) GetCouponInfo(in *CouponRequest, out *CouponResponse) error { return c.Call("CouponService.GetCouponInfo", in, out) } // DialCouponService connects to an CouponService at the specified network address. func DialCouponService(network, addr string) (*CouponServiceClient, *rpc.Client, error) { c, err := protorpc.Dial(network, addr) if err != nil { return nil, nil, err } return &CouponServiceClient{c}, c, nil } // DialCouponServiceTimeout connects to an CouponService at the specified network address. func DialCouponServiceTimeout(network, addr string, timeout time.Duration) (*CouponServiceClient, *rpc.Client, error) { c, err := protorpc.DialTimeout(network, addr, timeout) if err != nil { return nil, nil, err } return &CouponServiceClient{c}, c, nil }