refactor: localize protobuf definitions
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
package market
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -34,15 +33,15 @@ const (
|
||||
// 营销服务 - 供应商
|
||||
type SupplyClient interface {
|
||||
// 新增供应商
|
||||
Create(ctx context.Context, in *MarketSupplyItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Create(ctx context.Context, in *MarketSupplyItem, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 获取一个供应商
|
||||
Get(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*MarketSupplyItem, error)
|
||||
Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*MarketSupplyItem, error)
|
||||
// 供应商列表
|
||||
Fetch(ctx context.Context, in *protobuf.MarketFetchRequest, opts ...grpc.CallOption) (*SupplyReply, error)
|
||||
Fetch(ctx context.Context, in *MarketFetchRequest, opts ...grpc.CallOption) (*SupplyReply, error)
|
||||
// 更新供应商数据
|
||||
Modify(ctx context.Context, in *MarketSupplyItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Modify(ctx context.Context, in *MarketSupplyItem, 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)
|
||||
}
|
||||
|
||||
type supplyClient struct {
|
||||
@@ -53,9 +52,9 @@ func NewSupplyClient(cc grpc.ClientConnInterface) SupplyClient {
|
||||
return &supplyClient{cc}
|
||||
}
|
||||
|
||||
func (c *supplyClient) Create(ctx context.Context, in *MarketSupplyItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *supplyClient) Create(ctx context.Context, in *MarketSupplyItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Supply_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -63,7 +62,7 @@ func (c *supplyClient) Create(ctx context.Context, in *MarketSupplyItem, opts ..
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *supplyClient) Get(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*MarketSupplyItem, error) {
|
||||
func (c *supplyClient) Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*MarketSupplyItem, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(MarketSupplyItem)
|
||||
err := c.cc.Invoke(ctx, Supply_Get_FullMethodName, in, out, cOpts...)
|
||||
@@ -73,7 +72,7 @@ func (c *supplyClient) Get(ctx context.Context, in *protobuf.IdentRequest, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *supplyClient) Fetch(ctx context.Context, in *protobuf.MarketFetchRequest, opts ...grpc.CallOption) (*SupplyReply, error) {
|
||||
func (c *supplyClient) Fetch(ctx context.Context, in *MarketFetchRequest, opts ...grpc.CallOption) (*SupplyReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SupplyReply)
|
||||
err := c.cc.Invoke(ctx, Supply_Fetch_FullMethodName, in, out, cOpts...)
|
||||
@@ -83,9 +82,9 @@ func (c *supplyClient) Fetch(ctx context.Context, in *protobuf.MarketFetchReques
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *supplyClient) Modify(ctx context.Context, in *MarketSupplyItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *supplyClient) Modify(ctx context.Context, in *MarketSupplyItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Supply_Modify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -93,9 +92,9 @@ func (c *supplyClient) Modify(ctx context.Context, in *MarketSupplyItem, opts ..
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *supplyClient) Delete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *supplyClient) 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, Supply_Delete_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -110,15 +109,15 @@ func (c *supplyClient) Delete(ctx context.Context, in *protobuf.IdentRequest, op
|
||||
// 营销服务 - 供应商
|
||||
type SupplyServer interface {
|
||||
// 新增供应商
|
||||
Create(context.Context, *MarketSupplyItem) (*protobuf.IdentityStatusReply, error)
|
||||
Create(context.Context, *MarketSupplyItem) (*IdentityStatusReply, error)
|
||||
// 获取一个供应商
|
||||
Get(context.Context, *protobuf.IdentRequest) (*MarketSupplyItem, error)
|
||||
Get(context.Context, *IdentRequest) (*MarketSupplyItem, error)
|
||||
// 供应商列表
|
||||
Fetch(context.Context, *protobuf.MarketFetchRequest) (*SupplyReply, error)
|
||||
Fetch(context.Context, *MarketFetchRequest) (*SupplyReply, error)
|
||||
// 更新供应商数据
|
||||
Modify(context.Context, *MarketSupplyItem) (*protobuf.IdentityStatusReply, error)
|
||||
Modify(context.Context, *MarketSupplyItem) (*IdentityStatusReply, error)
|
||||
// 删除一个供应商
|
||||
Delete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error)
|
||||
Delete(context.Context, *IdentRequest) (*IdentityStatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedSupplyServer should be embedded to have
|
||||
@@ -128,19 +127,19 @@ type SupplyServer interface {
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedSupplyServer struct{}
|
||||
|
||||
func (UnimplementedSupplyServer) Create(context.Context, *MarketSupplyItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedSupplyServer) Create(context.Context, *MarketSupplyItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedSupplyServer) Get(context.Context, *protobuf.IdentRequest) (*MarketSupplyItem, error) {
|
||||
func (UnimplementedSupplyServer) Get(context.Context, *IdentRequest) (*MarketSupplyItem, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedSupplyServer) Fetch(context.Context, *protobuf.MarketFetchRequest) (*SupplyReply, error) {
|
||||
func (UnimplementedSupplyServer) Fetch(context.Context, *MarketFetchRequest) (*SupplyReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
|
||||
}
|
||||
func (UnimplementedSupplyServer) Modify(context.Context, *MarketSupplyItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedSupplyServer) Modify(context.Context, *MarketSupplyItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
|
||||
}
|
||||
func (UnimplementedSupplyServer) Delete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedSupplyServer) Delete(context.Context, *IdentRequest) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (UnimplementedSupplyServer) testEmbeddedByValue() {}
|
||||
@@ -182,7 +181,7 @@ func _Supply_Create_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
}
|
||||
|
||||
func _Supply_Get_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
|
||||
}
|
||||
@@ -194,13 +193,13 @@ func _Supply_Get_Handler(srv interface{}, ctx context.Context, dec func(interfac
|
||||
FullMethod: Supply_Get_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SupplyServer).Get(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(SupplyServer).Get(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Supply_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.MarketFetchRequest)
|
||||
in := new(MarketFetchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -212,7 +211,7 @@ func _Supply_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
FullMethod: Supply_Fetch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SupplyServer).Fetch(ctx, req.(*protobuf.MarketFetchRequest))
|
||||
return srv.(SupplyServer).Fetch(ctx, req.(*MarketFetchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -236,7 +235,7 @@ func _Supply_Modify_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
}
|
||||
|
||||
func _Supply_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
|
||||
}
|
||||
@@ -248,7 +247,7 @@ func _Supply_Delete_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
FullMethod: Supply_Delete_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SupplyServer).Delete(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(SupplyServer).Delete(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user