商品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.

319 lines
8.6 KiB

// Code generated by protoc-gen-go.
// source: product.proto
// DO NOT EDIT!
/*
Package productrpc is a generated protocol buffer package.
It is generated from these files:
product.proto
It has these top-level messages:
GetRequest
GetUuidRequest
GetResponse
Request
Response
*/
package productrpc
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
// 使用key查询
type GetRequest struct {
SiteId *string `protobuf:"bytes,1,opt,name=site_id" json:"site_id,omitempty"`
Dbname *string `protobuf:"bytes,2,opt,name=dbname" json:"dbname,omitempty"`
Id *string `protobuf:"bytes,3,opt,name=id" json:"id,omitempty"`
Field *string `protobuf:"bytes,4,opt,name=field" json:"field,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 *GetRequest) GetSiteId() string {
if m != nil && m.SiteId != nil {
return *m.SiteId
}
return ""
}
func (m *GetRequest) GetDbname() string {
if m != nil && m.Dbname != nil {
return *m.Dbname
}
return ""
}
func (m *GetRequest) GetId() string {
if m != nil && m.Id != nil {
return *m.Id
}
return ""
}
func (m *GetRequest) GetField() string {
if m != nil && m.Field != nil {
return *m.Field
}
return ""
}
type GetUuidRequest struct {
SiteId *string `protobuf:"bytes,1,opt,name=site_id" json:"site_id,omitempty"`
Dbname *string `protobuf:"bytes,2,opt,name=dbname" json:"dbname,omitempty"`
Uuid *string `protobuf:"bytes,3,opt,name=uuid" json:"uuid,omitempty"`
Field *string `protobuf:"bytes,4,opt,name=field" json:"field,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) GetSiteId() string {
if m != nil && m.SiteId != nil {
return *m.SiteId
}
return ""
}
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
}
return ""
}
func (m *GetUuidRequest) GetField() string {
if m != nil && m.Field != nil {
return *m.Field
}
return ""
}
// 使用key查询响应结构
type GetResponse struct {
Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,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 *GetResponse) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
// 配置信息请求结构
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 ProductService interface {
Get(in *GetRequest, out *GetResponse) error
GetByUuid(in *GetUuidRequest, out *GetResponse) error
GetSku(in *GetRequest, out *GetResponse) error
GetSkuByUuid(in *GetUuidRequest, out *GetResponse) error
GetActivity(in *Request, out *Response) error
GetAllActivity(in *Request, out *Response) error
GetWarmingActivity(in *Request, out *Response) error
}
// AcceptProductServiceClient 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) {
srv := rpc.NewServer()
if err := srv.RegisterName("ProductService", 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))
}
}
// 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 {
return err
}
return nil
}
// NewProductServiceServer returns a new ProductService Server.
func NewProductServiceServer(x ProductService) *rpc.Server {
srv := rpc.NewServer()
if err := srv.RegisterName("ProductService", 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 {
lis, err := net.Listen(network, addr)
if err != nil {
return err
}
defer lis.Close()
srv := rpc.NewServer()
if err := srv.RegisterName("ProductService", 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 ProductServiceClient 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) {
c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
return &ProductServiceClient{c}, c
}
func (c *ProductServiceClient) Get(in *GetRequest, out *GetResponse) error {
return c.Call("ProductService.Get", in, out)
}
func (c *ProductServiceClient) GetByUuid(in *GetUuidRequest, out *GetResponse) error {
return c.Call("ProductService.GetByUuid", in, out)
}
func (c *ProductServiceClient) GetSku(in *GetRequest, out *GetResponse) error {
return c.Call("ProductService.GetSku", in, out)
}
func (c *ProductServiceClient) GetSkuByUuid(in *GetUuidRequest, out *GetResponse) error {
return c.Call("ProductService.GetSkuByUuid", in, out)
}
func (c *ProductServiceClient) GetActivity(in *Request, out *Response) error {
return c.Call("ProductService.GetActivity", in, out)
}
func (c *ProductServiceClient) GetAllActivity(in *Request, out *Response) error {
return c.Call("ProductService.GetAllActivity", in, out)
}
func (c *ProductServiceClient) GetWarmingActivity(in *Request, out *Response) error {
return c.Call("ProductService.GetWarmingActivity", in, out)
}
// DialProductService connects to an ProductService at the specified network address.
func DialProductService(network, addr string) (*ProductServiceClient, *rpc.Client, error) {
c, err := protorpc.Dial(network, addr)
if err != nil {
return nil, nil, err
}
return &ProductServiceClient{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) {
c, err := protorpc.DialTimeout(network, addr, timeout)
if err != nil {
return nil, nil, err
}
return &ProductServiceClient{c}, c, nil
}