diff --git a/getinfo.go b/getinfo.go index 7af3399..b6c5f3b 100644 --- a/getinfo.go +++ b/getinfo.go @@ -12,7 +12,7 @@ import ( * 2021/08/20 * GZ */ -func Get(dbname, id string, url ...string) (map[string]string, error) { +func Get(dbname, id string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -20,7 +20,7 @@ func Get(dbname, id string, url ...string) (map[string]string, error) { } defer conn.Close() - req := &GetRequest{proto.String(dbname), proto.String(id), nil} + req := &GetRequest{proto.String(dbname), proto.String(id), proto.String(field), nil} res := &GetResponse{} @@ -45,7 +45,7 @@ func Get(dbname, id string, url ...string) (map[string]string, error) { * 2021/08/20 * GZ */ -func GetByUuid(dbname, uuid string, url ...string) (map[string]string, error) { +func GetByUuid(dbname, uuid string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -53,7 +53,7 @@ func GetByUuid(dbname, uuid string, url ...string) (map[string]string, error) { } defer conn.Close() - req := &GetUuidRequest{proto.String(dbname), proto.String(uuid), nil} + req := &GetUuidRequest{proto.String(dbname), proto.String(uuid), proto.String(field), nil} res := &GetResponse{} diff --git a/getskuinfo.go b/getskuinfo.go index e33d025..5850199 100644 --- a/getskuinfo.go +++ b/getskuinfo.go @@ -12,7 +12,7 @@ import ( * 2021/08/20 * GZ */ -func GetSku(dbname, id string, url ...string) (map[string]string, error) { +func GetSku(dbname, id string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -20,7 +20,7 @@ func GetSku(dbname, id string, url ...string) (map[string]string, error) { } defer conn.Close() - req := &GetRequest{proto.String(dbname), proto.String(id), nil} + req := &GetRequest{proto.String(dbname), proto.String(id), proto.String(field), nil} res := &GetResponse{} @@ -45,7 +45,7 @@ func GetSku(dbname, id string, url ...string) (map[string]string, error) { * 2021/08/20 * GZ */ -func GetSkuByUuid(dbname, uuid string, url ...string) (map[string]string, error) { +func GetSkuByUuid(dbname, uuid string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -53,7 +53,7 @@ func GetSkuByUuid(dbname, uuid string, url ...string) (map[string]string, error) } defer conn.Close() - req := &GetUuidRequest{proto.String(dbname), proto.String(uuid), nil} + req := &GetUuidRequest{proto.String(dbname), proto.String(uuid), proto.String(field), nil} res := &GetResponse{} diff --git a/product.pb.go b/product.pb.go index da1979e..316df0c 100644 --- a/product.pb.go +++ b/product.pb.go @@ -33,6 +33,7 @@ var _ = math.Inf type GetRequest struct { Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"` Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` + Field *string `protobuf:"bytes,3,opt,name=field" json:"field,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -54,9 +55,17 @@ func (m *GetRequest) GetId() string { return "" } +func (m *GetRequest) GetField() string { + if m != nil && m.Field != nil { + return *m.Field + } + return "" +} + type GetUuidRequest struct { Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"` Uuid *string `protobuf:"bytes,2,opt,name=uuid" json:"uuid,omitempty"` + Field *string `protobuf:"bytes,3,opt,name=field" json:"field,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -78,6 +87,13 @@ func (m *GetUuidRequest) GetUuid() string { 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"` diff --git a/product.proto b/product.proto index 6d02c54..1f7dd53 100644 --- a/product.proto +++ b/product.proto @@ -5,11 +5,13 @@ package productrpc; message GetRequest { string dbname = 1; string id = 2; + string field = 3; } message GetUuidRequest { string dbname = 1; string uuid = 2; + string field = 3; } // 使用key查询响应结构