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