Browse Source

更换包名

master v0.4.0
guzeng 3 years ago
parent
commit
d49a7640bd
5 changed files with 35 additions and 35 deletions
  1. +1
    -1
      client.balance.go
  2. +3
    -3
      client.go
  3. +1
    -1
      client_test.go
  4. +24
    -24
      site.pb.go
  5. +6
    -6
      site.proto

+ 1
- 1
client.balance.go View File

@ -1,4 +1,4 @@
package site
package siterpc
// import ( // import (
// "encoding/json" // "encoding/json"


+ 3
- 3
client.go View File

@ -1,4 +1,4 @@
package site
package siterpc
import ( import (
"crypto/md5" "crypto/md5"
@ -72,9 +72,9 @@ func getconfig(site_id, dbname, key string, url ...string) (*SiteConfigItemRes,
sign := Sign(encryData, now) sign := Sign(encryData, now)
req := &ConfigRequest{proto.String(encryData), proto.String(now), proto.String(sign), nil}
req := &Request{proto.String(encryData), proto.String(now), proto.String(sign), nil}
res := &ConfigResponse{}
res := &Response{}
err = conn.GetConfig(req, res) err = conn.GetConfig(req, res)


+ 1
- 1
client_test.go View File

@ -1,4 +1,4 @@
package site
package siterpc
import ( import (
"testing" "testing"


+ 24
- 24
site.pb.go View File

@ -3,16 +3,16 @@
// DO NOT EDIT! // DO NOT EDIT!
/* /*
Package site is a generated protocol buffer package.
Package siterpc is a generated protocol buffer package.
It is generated from these files: It is generated from these files:
site.proto site.proto
It has these top-level messages: It has these top-level messages:
ConfigRequest
ConfigResponse
Request
Response
*/ */
package site
package siterpc
import proto "github.com/chai2010/protorpc/proto" import proto "github.com/chai2010/protorpc/proto"
import math "math" import math "math"
@ -29,32 +29,32 @@ var _ = proto.Marshal
var _ = math.Inf var _ = math.Inf
// 配置信息请求结构 // 配置信息请求结构
type ConfigRequest struct {
type Request struct {
Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"` Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"` Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
} }
func (m *ConfigRequest) Reset() { *m = ConfigRequest{} }
func (m *ConfigRequest) String() string { return proto.CompactTextString(m) }
func (*ConfigRequest) ProtoMessage() {}
func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {}
func (m *ConfigRequest) GetData() string {
func (m *Request) GetData() string {
if m != nil && m.Data != nil { if m != nil && m.Data != nil {
return *m.Data return *m.Data
} }
return "" return ""
} }
func (m *ConfigRequest) GetTime() string {
func (m *Request) GetTime() string {
if m != nil && m.Time != nil { if m != nil && m.Time != nil {
return *m.Time return *m.Time
} }
return "" return ""
} }
func (m *ConfigRequest) GetSign() string {
func (m *Request) GetSign() string {
if m != nil && m.Sign != nil { if m != nil && m.Sign != nil {
return *m.Sign return *m.Sign
} }
@ -62,32 +62,32 @@ func (m *ConfigRequest) GetSign() string {
} }
// 配置信息响应结构 // 配置信息响应结构
type ConfigResponse struct {
type Response struct {
Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"` Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"` Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"` Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
} }
func (m *ConfigResponse) Reset() { *m = ConfigResponse{} }
func (m *ConfigResponse) String() string { return proto.CompactTextString(m) }
func (*ConfigResponse) ProtoMessage() {}
func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (m *ConfigResponse) GetData() string {
func (m *Response) GetData() string {
if m != nil && m.Data != nil { if m != nil && m.Data != nil {
return *m.Data return *m.Data
} }
return "" return ""
} }
func (m *ConfigResponse) GetTime() string {
func (m *Response) GetTime() string {
if m != nil && m.Time != nil { if m != nil && m.Time != nil {
return *m.Time return *m.Time
} }
return "" return ""
} }
func (m *ConfigResponse) GetSign() string {
func (m *Response) GetSign() string {
if m != nil && m.Sign != nil { if m != nil && m.Sign != nil {
return *m.Sign return *m.Sign
} }
@ -98,9 +98,9 @@ func init() {
} }
type SiteService interface { type SiteService interface {
GetConfig(in *ConfigRequest, out *ConfigResponse) error
GetBalanceType(in *ConfigRequest, out *ConfigResponse) error
GetAllSite(in *ConfigRequest, out *ConfigResponse) error
GetConfig(in *Request, out *Response) error
GetBalanceType(in *Request, out *Response) error
GetAllSite(in *Request, out *Response) error
} }
// AcceptSiteServiceClient accepts connections on the listener and serves requests // AcceptSiteServiceClient accepts connections on the listener and serves requests
@ -172,13 +172,13 @@ func NewSiteServiceClient(conn io.ReadWriteCloser) (*SiteServiceClient, *rpc.Cli
return &SiteServiceClient{c}, c return &SiteServiceClient{c}, c
} }
func (c *SiteServiceClient) GetConfig(in *ConfigRequest, out *ConfigResponse) error {
func (c *SiteServiceClient) GetConfig(in *Request, out *Response) error {
return c.Call("SiteService.GetConfig", in, out) return c.Call("SiteService.GetConfig", in, out)
} }
func (c *SiteServiceClient) GetBalanceType(in *ConfigRequest, out *ConfigResponse) error {
func (c *SiteServiceClient) GetBalanceType(in *Request, out *Response) error {
return c.Call("SiteService.GetBalanceType", in, out) return c.Call("SiteService.GetBalanceType", in, out)
} }
func (c *SiteServiceClient) GetAllSite(in *ConfigRequest, out *ConfigResponse) error {
func (c *SiteServiceClient) GetAllSite(in *Request, out *Response) error {
return c.Call("SiteService.GetAllSite", in, out) return c.Call("SiteService.GetAllSite", in, out)
} }


+ 6
- 6
site.proto View File

@ -1,15 +1,15 @@
syntax = "proto3"; syntax = "proto3";
package site;
package siterpc;
// //
message ConfigRequest {
message Request {
string data = 1; string data = 1;
string time = 2; string time = 2;
string sign = 3; string sign = 3;
} }
// //
message ConfigResponse {
message Response {
string data = 1; string data = 1;
string time = 2; string time = 2;
string sign = 3; string sign = 3;
@ -18,7 +18,7 @@ message ConfigResponse {
// rpc方法 // rpc方法
service SiteService { service SiteService {
rpc getConfig (ConfigRequest) returns (ConfigResponse); //
rpc getBalanceType (ConfigRequest) returns (ConfigResponse); //
rpc getAllSite(ConfigRequest) returns (ConfigResponse);//
rpc getConfig (Request) returns (Response); //
rpc getBalanceType (Request) returns (Response); //
rpc getAllSite(Request) returns (Response);//
} }

Loading…
Cancel
Save