refactor: localize protobuf definitions
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
package mall
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -38,23 +37,23 @@ const (
|
||||
// 运费设置相关
|
||||
type FreightClient interface {
|
||||
// 运费模板列表
|
||||
Fetch(ctx context.Context, in *protobuf.MallFetchRequest, opts ...grpc.CallOption) (*FreightReply, error)
|
||||
Fetch(ctx context.Context, in *MallFetchRequest, opts ...grpc.CallOption) (*FreightReply, error)
|
||||
// 运费模板修改
|
||||
Modify(ctx context.Context, in *FreightItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Modify(ctx context.Context, in *FreightItem, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 运费模板删除
|
||||
Delete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 运费模板创建
|
||||
Create(ctx context.Context, in *FreightItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Create(ctx context.Context, in *FreightItem, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 运费模板详情
|
||||
Detail(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*FreightItem, error)
|
||||
Detail(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*FreightItem, error)
|
||||
// 限制区域列表
|
||||
DenyRegionFetch(ctx context.Context, in *protobuf.MallFetchRequest, opts ...grpc.CallOption) (*DenyRegionReply, error)
|
||||
DenyRegionFetch(ctx context.Context, in *MallFetchRequest, opts ...grpc.CallOption) (*DenyRegionReply, error)
|
||||
// 新建限制区域
|
||||
DenyRegionCreate(ctx context.Context, in *DenyRegionItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
DenyRegionCreate(ctx context.Context, in *DenyRegionItem, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 移除限制区域
|
||||
DenyRegionDelete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
DenyRegionDelete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 编辑限制区域
|
||||
DenyRegionModify(ctx context.Context, in *DenyRegionItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
DenyRegionModify(ctx context.Context, in *DenyRegionItem, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
}
|
||||
|
||||
type freightClient struct {
|
||||
@@ -65,7 +64,7 @@ func NewFreightClient(cc grpc.ClientConnInterface) FreightClient {
|
||||
return &freightClient{cc}
|
||||
}
|
||||
|
||||
func (c *freightClient) Fetch(ctx context.Context, in *protobuf.MallFetchRequest, opts ...grpc.CallOption) (*FreightReply, error) {
|
||||
func (c *freightClient) Fetch(ctx context.Context, in *MallFetchRequest, opts ...grpc.CallOption) (*FreightReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(FreightReply)
|
||||
err := c.cc.Invoke(ctx, Freight_Fetch_FullMethodName, in, out, cOpts...)
|
||||
@@ -75,9 +74,9 @@ func (c *freightClient) Fetch(ctx context.Context, in *protobuf.MallFetchRequest
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *freightClient) Modify(ctx context.Context, in *FreightItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *freightClient) Modify(ctx context.Context, in *FreightItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Freight_Modify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -85,9 +84,9 @@ func (c *freightClient) Modify(ctx context.Context, in *FreightItem, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *freightClient) Delete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *freightClient) Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Freight_Delete_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -95,9 +94,9 @@ func (c *freightClient) Delete(ctx context.Context, in *protobuf.IdentRequest, o
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *freightClient) Create(ctx context.Context, in *FreightItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *freightClient) Create(ctx context.Context, in *FreightItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Freight_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -105,7 +104,7 @@ func (c *freightClient) Create(ctx context.Context, in *FreightItem, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *freightClient) Detail(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*FreightItem, error) {
|
||||
func (c *freightClient) Detail(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*FreightItem, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(FreightItem)
|
||||
err := c.cc.Invoke(ctx, Freight_Detail_FullMethodName, in, out, cOpts...)
|
||||
@@ -115,7 +114,7 @@ func (c *freightClient) Detail(ctx context.Context, in *protobuf.IdentRequest, o
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *freightClient) DenyRegionFetch(ctx context.Context, in *protobuf.MallFetchRequest, opts ...grpc.CallOption) (*DenyRegionReply, error) {
|
||||
func (c *freightClient) DenyRegionFetch(ctx context.Context, in *MallFetchRequest, opts ...grpc.CallOption) (*DenyRegionReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DenyRegionReply)
|
||||
err := c.cc.Invoke(ctx, Freight_DenyRegionFetch_FullMethodName, in, out, cOpts...)
|
||||
@@ -125,9 +124,9 @@ func (c *freightClient) DenyRegionFetch(ctx context.Context, in *protobuf.MallFe
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *freightClient) DenyRegionCreate(ctx context.Context, in *DenyRegionItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *freightClient) DenyRegionCreate(ctx context.Context, in *DenyRegionItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Freight_DenyRegionCreate_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -135,9 +134,9 @@ func (c *freightClient) DenyRegionCreate(ctx context.Context, in *DenyRegionItem
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *freightClient) DenyRegionDelete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *freightClient) DenyRegionDelete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Freight_DenyRegionDelete_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -145,9 +144,9 @@ func (c *freightClient) DenyRegionDelete(ctx context.Context, in *protobuf.Ident
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *freightClient) DenyRegionModify(ctx context.Context, in *DenyRegionItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *freightClient) DenyRegionModify(ctx context.Context, in *DenyRegionItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Freight_DenyRegionModify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -162,23 +161,23 @@ func (c *freightClient) DenyRegionModify(ctx context.Context, in *DenyRegionItem
|
||||
// 运费设置相关
|
||||
type FreightServer interface {
|
||||
// 运费模板列表
|
||||
Fetch(context.Context, *protobuf.MallFetchRequest) (*FreightReply, error)
|
||||
Fetch(context.Context, *MallFetchRequest) (*FreightReply, error)
|
||||
// 运费模板修改
|
||||
Modify(context.Context, *FreightItem) (*protobuf.IdentityStatusReply, error)
|
||||
Modify(context.Context, *FreightItem) (*IdentityStatusReply, error)
|
||||
// 运费模板删除
|
||||
Delete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error)
|
||||
Delete(context.Context, *IdentRequest) (*IdentityStatusReply, error)
|
||||
// 运费模板创建
|
||||
Create(context.Context, *FreightItem) (*protobuf.IdentityStatusReply, error)
|
||||
Create(context.Context, *FreightItem) (*IdentityStatusReply, error)
|
||||
// 运费模板详情
|
||||
Detail(context.Context, *protobuf.IdentRequest) (*FreightItem, error)
|
||||
Detail(context.Context, *IdentRequest) (*FreightItem, error)
|
||||
// 限制区域列表
|
||||
DenyRegionFetch(context.Context, *protobuf.MallFetchRequest) (*DenyRegionReply, error)
|
||||
DenyRegionFetch(context.Context, *MallFetchRequest) (*DenyRegionReply, error)
|
||||
// 新建限制区域
|
||||
DenyRegionCreate(context.Context, *DenyRegionItem) (*protobuf.IdentityStatusReply, error)
|
||||
DenyRegionCreate(context.Context, *DenyRegionItem) (*IdentityStatusReply, error)
|
||||
// 移除限制区域
|
||||
DenyRegionDelete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error)
|
||||
DenyRegionDelete(context.Context, *IdentRequest) (*IdentityStatusReply, error)
|
||||
// 编辑限制区域
|
||||
DenyRegionModify(context.Context, *DenyRegionItem) (*protobuf.IdentityStatusReply, error)
|
||||
DenyRegionModify(context.Context, *DenyRegionItem) (*IdentityStatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedFreightServer should be embedded to have
|
||||
@@ -188,31 +187,31 @@ type FreightServer interface {
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedFreightServer struct{}
|
||||
|
||||
func (UnimplementedFreightServer) Fetch(context.Context, *protobuf.MallFetchRequest) (*FreightReply, error) {
|
||||
func (UnimplementedFreightServer) Fetch(context.Context, *MallFetchRequest) (*FreightReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) Modify(context.Context, *FreightItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedFreightServer) Modify(context.Context, *FreightItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) Delete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedFreightServer) Delete(context.Context, *IdentRequest) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) Create(context.Context, *FreightItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedFreightServer) Create(context.Context, *FreightItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) Detail(context.Context, *protobuf.IdentRequest) (*FreightItem, error) {
|
||||
func (UnimplementedFreightServer) Detail(context.Context, *IdentRequest) (*FreightItem, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Detail not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) DenyRegionFetch(context.Context, *protobuf.MallFetchRequest) (*DenyRegionReply, error) {
|
||||
func (UnimplementedFreightServer) DenyRegionFetch(context.Context, *MallFetchRequest) (*DenyRegionReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DenyRegionFetch not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) DenyRegionCreate(context.Context, *DenyRegionItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedFreightServer) DenyRegionCreate(context.Context, *DenyRegionItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DenyRegionCreate not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) DenyRegionDelete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedFreightServer) DenyRegionDelete(context.Context, *IdentRequest) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DenyRegionDelete not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) DenyRegionModify(context.Context, *DenyRegionItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedFreightServer) DenyRegionModify(context.Context, *DenyRegionItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DenyRegionModify not implemented")
|
||||
}
|
||||
func (UnimplementedFreightServer) testEmbeddedByValue() {}
|
||||
@@ -236,7 +235,7 @@ func RegisterFreightServer(s grpc.ServiceRegistrar, srv FreightServer) {
|
||||
}
|
||||
|
||||
func _Freight_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.MallFetchRequest)
|
||||
in := new(MallFetchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -248,7 +247,7 @@ func _Freight_Fetch_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
FullMethod: Freight_Fetch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FreightServer).Fetch(ctx, req.(*protobuf.MallFetchRequest))
|
||||
return srv.(FreightServer).Fetch(ctx, req.(*MallFetchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -272,7 +271,7 @@ func _Freight_Modify_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
|
||||
func _Freight_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.IdentRequest)
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -284,7 +283,7 @@ func _Freight_Delete_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
FullMethod: Freight_Delete_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FreightServer).Delete(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(FreightServer).Delete(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -308,7 +307,7 @@ func _Freight_Create_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
|
||||
func _Freight_Detail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.IdentRequest)
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -320,13 +319,13 @@ func _Freight_Detail_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
FullMethod: Freight_Detail_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FreightServer).Detail(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(FreightServer).Detail(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Freight_DenyRegionFetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.MallFetchRequest)
|
||||
in := new(MallFetchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -338,7 +337,7 @@ func _Freight_DenyRegionFetch_Handler(srv interface{}, ctx context.Context, dec
|
||||
FullMethod: Freight_DenyRegionFetch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FreightServer).DenyRegionFetch(ctx, req.(*protobuf.MallFetchRequest))
|
||||
return srv.(FreightServer).DenyRegionFetch(ctx, req.(*MallFetchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -362,7 +361,7 @@ func _Freight_DenyRegionCreate_Handler(srv interface{}, ctx context.Context, dec
|
||||
}
|
||||
|
||||
func _Freight_DenyRegionDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.IdentRequest)
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -374,7 +373,7 @@ func _Freight_DenyRegionDelete_Handler(srv interface{}, ctx context.Context, dec
|
||||
FullMethod: Freight_DenyRegionDelete_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FreightServer).DenyRegionDelete(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(FreightServer).DenyRegionDelete(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user