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"
|
||||
@@ -35,11 +34,11 @@ type CategoryClient interface {
|
||||
// 获取分类数据
|
||||
Fetch(ctx context.Context, in *CategoryFetchRequest, opts ...grpc.CallOption) (*CategoryReply, error)
|
||||
// 添加分类
|
||||
Create(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Create(ctx context.Context, in *CategoryItem, 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)
|
||||
// 修改分类
|
||||
Modify(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Modify(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
}
|
||||
|
||||
type categoryClient struct {
|
||||
@@ -60,9 +59,9 @@ func (c *categoryClient) Fetch(ctx context.Context, in *CategoryFetchRequest, op
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) Create(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *categoryClient) Create(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Category_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -70,9 +69,9 @@ func (c *categoryClient) Create(ctx context.Context, in *CategoryItem, opts ...g
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) Delete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *categoryClient) 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, Category_Delete_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -80,9 +79,9 @@ func (c *categoryClient) Delete(ctx context.Context, in *protobuf.IdentRequest,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) Modify(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *categoryClient) Modify(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Category_Modify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -99,11 +98,11 @@ type CategoryServer interface {
|
||||
// 获取分类数据
|
||||
Fetch(context.Context, *CategoryFetchRequest) (*CategoryReply, error)
|
||||
// 添加分类
|
||||
Create(context.Context, *CategoryItem) (*protobuf.IdentityStatusReply, error)
|
||||
Create(context.Context, *CategoryItem) (*IdentityStatusReply, error)
|
||||
// 删除分类
|
||||
Delete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error)
|
||||
Delete(context.Context, *IdentRequest) (*IdentityStatusReply, error)
|
||||
// 修改分类
|
||||
Modify(context.Context, *CategoryItem) (*protobuf.IdentityStatusReply, error)
|
||||
Modify(context.Context, *CategoryItem) (*IdentityStatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedCategoryServer should be embedded to have
|
||||
@@ -116,13 +115,13 @@ type UnimplementedCategoryServer struct{}
|
||||
func (UnimplementedCategoryServer) Fetch(context.Context, *CategoryFetchRequest) (*CategoryReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) Create(context.Context, *CategoryItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedCategoryServer) Create(context.Context, *CategoryItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) Delete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedCategoryServer) Delete(context.Context, *IdentRequest) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) Modify(context.Context, *CategoryItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedCategoryServer) Modify(context.Context, *CategoryItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) testEmbeddedByValue() {}
|
||||
@@ -182,7 +181,7 @@ func _Category_Create_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
}
|
||||
|
||||
func _Category_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
|
||||
}
|
||||
@@ -194,7 +193,7 @@ func _Category_Delete_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
FullMethod: Category_Delete_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CategoryServer).Delete(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(CategoryServer).Delete(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user