Browse Source

adjust address

master
jaydan 2 years ago
parent
commit
21a24c0aef
  1. 192
      address/v1/address.pb.go
  2. 11
      address/v1/address.proto
  3. 40
      address/v1/address_grpc.pb.go

192
address/v1/address.pb.go

@ -785,6 +785,91 @@ func (x *QueryAddressByAddressListResp) GetAddress() *Division {
return nil
}
type QueryAllAddressMapReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *QueryAllAddressMapReq) Reset() {
*x = QueryAllAddressMapReq{}
if protoimpl.UnsafeEnabled {
mi := &file_address_v1_address_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryAllAddressMapReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryAllAddressMapReq) ProtoMessage() {}
func (x *QueryAllAddressMapReq) ProtoReflect() protoreflect.Message {
mi := &file_address_v1_address_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QueryAllAddressMapReq.ProtoReflect.Descriptor instead.
func (*QueryAllAddressMapReq) Descriptor() ([]byte, []int) {
return file_address_v1_address_proto_rawDescGZIP(), []int{15}
}
type QueryAllAddressMapResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
AddressMap map[string]*AddressMap `protobuf:"bytes,1,rep,name=address_map,json=addressMap,proto3" json:"address_map" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *QueryAllAddressMapResp) Reset() {
*x = QueryAllAddressMapResp{}
if protoimpl.UnsafeEnabled {
mi := &file_address_v1_address_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *QueryAllAddressMapResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*QueryAllAddressMapResp) ProtoMessage() {}
func (x *QueryAllAddressMapResp) ProtoReflect() protoreflect.Message {
mi := &file_address_v1_address_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use QueryAllAddressMapResp.ProtoReflect.Descriptor instead.
func (*QueryAllAddressMapResp) Descriptor() ([]byte, []int) {
return file_address_v1_address_proto_rawDescGZIP(), []int{16}
}
func (x *QueryAllAddressMapResp) GetAddressMap() map[string]*AddressMap {
if x != nil {
return x.AddressMap
}
return nil
}
var File_address_v1_address_proto protoreflect.FileDescriptor
var file_address_v1_address_proto_rawDesc = []byte{
@ -856,7 +941,21 @@ var file_address_v1_address_proto_rawDesc = []byte{
0x72, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2e, 0x0a, 0x07,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x76, 0x69, 0x73,
0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x32, 0x9f, 0x04, 0x0a,
0x69, 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x17, 0x0a, 0x15,
0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d,
0x61, 0x70, 0x52, 0x65, 0x71, 0x22, 0xc4, 0x01, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41,
0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70,
0x12, 0x53, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e,
0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x4d, 0x61, 0x70, 0x1a, 0x55, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x64, 0x64, 0x72,
0x65, 0x73, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x61,
0x70, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0xfc, 0x04, 0x0a,
0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x58, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x41, 0x6c, 0x6c, 0x44, 0x69, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x2e,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
@ -890,11 +989,17 @@ var file_address_v1_address_proto_rawDesc = []byte{
0x65, 0x73, 0x73, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74,
0x52, 0x65, 0x71, 0x1a, 0x29, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x76, 0x31,
0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x79, 0x41,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x35,
0x5a, 0x33, 0x67, 0x69, 0x74, 0x2e, 0x67, 0x7a, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
0x6c, 0x2e, 0x6a, 0x75, 0x6d, 0x61, 0x69, 0x79, 0x78, 0x2e, 0x63, 0x6e, 0x2f, 0x6a, 0x6d, 0x2f,
0x6a, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2f,
0x76, 0x31, 0x3b, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5b,
0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x4d, 0x61, 0x70, 0x12, 0x21, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x76,
0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64,
0x72, 0x65, 0x73, 0x73, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x42, 0x35, 0x5a, 0x33, 0x67,
0x69, 0x74, 0x2e, 0x67, 0x7a, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x6a,
0x75, 0x6d, 0x61, 0x69, 0x79, 0x78, 0x2e, 0x63, 0x6e, 0x2f, 0x6a, 0x6d, 0x2f, 0x6a, 0x6d, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2f, 0x76, 0x31, 0x3b,
0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -909,7 +1014,7 @@ func file_address_v1_address_proto_rawDescGZIP() []byte {
return file_address_v1_address_proto_rawDescData
}
var file_address_v1_address_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_address_v1_address_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
var file_address_v1_address_proto_goTypes = []interface{}{
(*Country)(nil), // 0: address.v1.Country
(*Division)(nil), // 1: address.v1.Division
@ -926,7 +1031,10 @@ var file_address_v1_address_proto_goTypes = []interface{}{
(*QueryAddressByAddressListReq)(nil), // 12: address.v1.QueryAddressByAddressListReq
(*AddressMap)(nil), // 13: address.v1.AddressMap
(*QueryAddressByAddressListResp)(nil), // 14: address.v1.QueryAddressByAddressListResp
nil, // 15: address.v1.AddressMap.SonEntry
(*QueryAllAddressMapReq)(nil), // 15: address.v1.QueryAllAddressMapReq
(*QueryAllAddressMapResp)(nil), // 16: address.v1.QueryAllAddressMapResp
nil, // 17: address.v1.AddressMap.SonEntry
nil, // 18: address.v1.QueryAllAddressMapResp.AddressMapEntry
}
var file_address_v1_address_proto_depIdxs = []int32{
1, // 0: address.v1.Division.children:type_name -> address.v1.Division
@ -934,26 +1042,30 @@ var file_address_v1_address_proto_depIdxs = []int32{
0, // 2: address.v1.UpdateAllCountryReq.items:type_name -> address.v1.Country
0, // 3: address.v1.GetCountriesResp.items:type_name -> address.v1.Country
1, // 4: address.v1.GetDivisionsResp.items:type_name -> address.v1.Division
15, // 5: address.v1.AddressMap.son:type_name -> address.v1.AddressMap.SonEntry
17, // 5: address.v1.AddressMap.son:type_name -> address.v1.AddressMap.SonEntry
1, // 6: address.v1.QueryAddressByAddressListResp.address:type_name -> address.v1.Division
13, // 7: address.v1.AddressMap.SonEntry.value:type_name -> address.v1.AddressMap
2, // 8: address.v1.Address.UpdateAllDivision:input_type -> address.v1.UpdateAllDivisionReq
4, // 9: address.v1.Address.UpdateAllCountry:input_type -> address.v1.UpdateAllCountryReq
6, // 10: address.v1.Address.GetCountries:input_type -> address.v1.GetCountriesReq
8, // 11: address.v1.Address.GetDivisions:input_type -> address.v1.GetDivisionsReq
10, // 12: address.v1.Address.VerifyDivisionTree:input_type -> address.v1.VerifyDivisionTreeReq
12, // 13: address.v1.Address.QueryAddressByAddressList:input_type -> address.v1.QueryAddressByAddressListReq
3, // 14: address.v1.Address.UpdateAllDivision:output_type -> address.v1.UpdateAllDivisionResp
5, // 15: address.v1.Address.UpdateAllCountry:output_type -> address.v1.UpdateAllCountryResp
7, // 16: address.v1.Address.GetCountries:output_type -> address.v1.GetCountriesResp
9, // 17: address.v1.Address.GetDivisions:output_type -> address.v1.GetDivisionsResp
11, // 18: address.v1.Address.VerifyDivisionTree:output_type -> address.v1.VerifyDivisionTreeResp
14, // 19: address.v1.Address.QueryAddressByAddressList:output_type -> address.v1.QueryAddressByAddressListResp
14, // [14:20] is the sub-list for method output_type
8, // [8:14] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
18, // 7: address.v1.QueryAllAddressMapResp.address_map:type_name -> address.v1.QueryAllAddressMapResp.AddressMapEntry
13, // 8: address.v1.AddressMap.SonEntry.value:type_name -> address.v1.AddressMap
13, // 9: address.v1.QueryAllAddressMapResp.AddressMapEntry.value:type_name -> address.v1.AddressMap
2, // 10: address.v1.Address.UpdateAllDivision:input_type -> address.v1.UpdateAllDivisionReq
4, // 11: address.v1.Address.UpdateAllCountry:input_type -> address.v1.UpdateAllCountryReq
6, // 12: address.v1.Address.GetCountries:input_type -> address.v1.GetCountriesReq
8, // 13: address.v1.Address.GetDivisions:input_type -> address.v1.GetDivisionsReq
10, // 14: address.v1.Address.VerifyDivisionTree:input_type -> address.v1.VerifyDivisionTreeReq
12, // 15: address.v1.Address.QueryAddressByAddressList:input_type -> address.v1.QueryAddressByAddressListReq
15, // 16: address.v1.Address.QueryAllAddressMap:input_type -> address.v1.QueryAllAddressMapReq
3, // 17: address.v1.Address.UpdateAllDivision:output_type -> address.v1.UpdateAllDivisionResp
5, // 18: address.v1.Address.UpdateAllCountry:output_type -> address.v1.UpdateAllCountryResp
7, // 19: address.v1.Address.GetCountries:output_type -> address.v1.GetCountriesResp
9, // 20: address.v1.Address.GetDivisions:output_type -> address.v1.GetDivisionsResp
11, // 21: address.v1.Address.VerifyDivisionTree:output_type -> address.v1.VerifyDivisionTreeResp
14, // 22: address.v1.Address.QueryAddressByAddressList:output_type -> address.v1.QueryAddressByAddressListResp
16, // 23: address.v1.Address.QueryAllAddressMap:output_type -> address.v1.QueryAllAddressMapResp
17, // [17:24] is the sub-list for method output_type
10, // [10:17] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
}
func init() { file_address_v1_address_proto_init() }
@ -1142,6 +1254,30 @@ func file_address_v1_address_proto_init() {
return nil
}
}
file_address_v1_address_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryAllAddressMapReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_address_v1_address_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*QueryAllAddressMapResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -1149,7 +1285,7 @@ func file_address_v1_address_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_address_v1_address_proto_rawDesc,
NumEnums: 0,
NumMessages: 16,
NumMessages: 19,
NumExtensions: 0,
NumServices: 1,
},

11
address/v1/address.proto

@ -23,8 +23,10 @@ service Address {
// bug设置不符合树形关系的地址信息
rpc VerifyDivisionTree(VerifyDivisionTreeReq) returns (VerifyDivisionTreeResp);
//
rpc QueryAddressByAddressList(QueryAddressByAddressListReq) returns (QueryAddressByAddressListResp);
//
rpc QueryAllAddressMap(QueryAllAddressMapReq) returns (QueryAllAddressMapResp);
}
message Country {
int32 id = 1;
@ -95,4 +97,11 @@ message AddressMap {
message QueryAddressByAddressListResp {
Division address = 5;
}
message QueryAllAddressMapReq {
}
message QueryAllAddressMapResp {
map<string, AddressMap> address_map = 1;
}

40
address/v1/address_grpc.pb.go

@ -37,8 +37,9 @@ type AddressClient interface {
GetDivisions(ctx context.Context, in *GetDivisionsReq, opts ...grpc.CallOption) (*GetDivisionsResp, error)
// 验证地区树是否未依赖关系(防止用户卡bug设置不符合树形关系的地址信息)
VerifyDivisionTree(ctx context.Context, in *VerifyDivisionTreeReq, opts ...grpc.CallOption) (*VerifyDivisionTreeResp, error)
// 获取全部地址映射表
QueryAddressByAddressList(ctx context.Context, in *QueryAddressByAddressListReq, opts ...grpc.CallOption) (*QueryAddressByAddressListResp, error)
// 获取全部地址映射表
QueryAllAddressMap(ctx context.Context, in *QueryAllAddressMapReq, opts ...grpc.CallOption) (*QueryAllAddressMapResp, error)
}
type addressClient struct {
@ -103,6 +104,15 @@ func (c *addressClient) QueryAddressByAddressList(ctx context.Context, in *Query
return out, nil
}
func (c *addressClient) QueryAllAddressMap(ctx context.Context, in *QueryAllAddressMapReq, opts ...grpc.CallOption) (*QueryAllAddressMapResp, error) {
out := new(QueryAllAddressMapResp)
err := c.cc.Invoke(ctx, "/address.v1.Address/QueryAllAddressMap", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AddressServer is the server API for Address service.
// All implementations must embed UnimplementedAddressServer
// for forward compatibility
@ -122,8 +132,9 @@ type AddressServer interface {
GetDivisions(context.Context, *GetDivisionsReq) (*GetDivisionsResp, error)
// 验证地区树是否未依赖关系(防止用户卡bug设置不符合树形关系的地址信息)
VerifyDivisionTree(context.Context, *VerifyDivisionTreeReq) (*VerifyDivisionTreeResp, error)
// 获取全部地址映射表
QueryAddressByAddressList(context.Context, *QueryAddressByAddressListReq) (*QueryAddressByAddressListResp, error)
// 获取全部地址映射表
QueryAllAddressMap(context.Context, *QueryAllAddressMapReq) (*QueryAllAddressMapResp, error)
mustEmbedUnimplementedAddressServer()
}
@ -149,6 +160,9 @@ func (UnimplementedAddressServer) VerifyDivisionTree(context.Context, *VerifyDiv
func (UnimplementedAddressServer) QueryAddressByAddressList(context.Context, *QueryAddressByAddressListReq) (*QueryAddressByAddressListResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryAddressByAddressList not implemented")
}
func (UnimplementedAddressServer) QueryAllAddressMap(context.Context, *QueryAllAddressMapReq) (*QueryAllAddressMapResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryAllAddressMap not implemented")
}
func (UnimplementedAddressServer) mustEmbedUnimplementedAddressServer() {}
// UnsafeAddressServer may be embedded to opt out of forward compatibility for this service.
@ -270,6 +284,24 @@ func _Address_QueryAddressByAddressList_Handler(srv interface{}, ctx context.Con
return interceptor(ctx, in, info, handler)
}
func _Address_QueryAllAddressMap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllAddressMapReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AddressServer).QueryAllAddressMap(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/address.v1.Address/QueryAllAddressMap",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AddressServer).QueryAllAddressMap(ctx, req.(*QueryAllAddressMapReq))
}
return interceptor(ctx, in, info, handler)
}
// Address_ServiceDesc is the grpc.ServiceDesc for Address service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -301,6 +333,10 @@ var Address_ServiceDesc = grpc.ServiceDesc{
MethodName: "QueryAddressByAddressList",
Handler: _Address_QueryAddressByAddressList_Handler,
},
{
MethodName: "QueryAllAddressMap",
Handler: _Address_QueryAllAddressMap_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "address/v1/address.proto",

Loading…
Cancel
Save