refactor: centralize protobuf and remove go-zero
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc (unknown)
|
||||
// source: category.proto
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v7.35.0
|
||||
// source: module/base/cms/proto/category.proto
|
||||
|
||||
package cms
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -32,13 +33,13 @@ const (
|
||||
// CMS - 分类
|
||||
type CategoryClient interface {
|
||||
// 分类列表
|
||||
Fetch(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*CategoryListReply, error)
|
||||
Fetch(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*CategoryListReply, error)
|
||||
// 添加分类
|
||||
Create(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
Create(ctx context.Context, in *protobuf.CmsCategoryItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
// 修改分类
|
||||
Modify(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
Modify(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
// 删除分类
|
||||
Delete(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
Delete(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
}
|
||||
|
||||
type categoryClient struct {
|
||||
@@ -49,7 +50,7 @@ func NewCategoryClient(cc grpc.ClientConnInterface) CategoryClient {
|
||||
return &categoryClient{cc}
|
||||
}
|
||||
|
||||
func (c *categoryClient) Fetch(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*CategoryListReply, error) {
|
||||
func (c *categoryClient) Fetch(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*CategoryListReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CategoryListReply)
|
||||
err := c.cc.Invoke(ctx, Category_Fetch_FullMethodName, in, out, cOpts...)
|
||||
@@ -59,9 +60,9 @@ func (c *categoryClient) Fetch(ctx context.Context, in *IdentRequest, opts ...gr
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) Create(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *categoryClient) Create(ctx context.Context, in *protobuf.CmsCategoryItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.StatusReply)
|
||||
err := c.cc.Invoke(ctx, Category_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -69,9 +70,9 @@ func (c *categoryClient) Create(ctx context.Context, in *CategoryItem, opts ...g
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) Modify(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *categoryClient) Modify(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.StatusReply)
|
||||
err := c.cc.Invoke(ctx, Category_Modify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -79,9 +80,9 @@ func (c *categoryClient) Modify(ctx context.Context, in *ModifyCategoryRequest,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) Delete(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *categoryClient) Delete(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.StatusReply)
|
||||
err := c.cc.Invoke(ctx, Category_Delete_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -90,43 +91,41 @@ func (c *categoryClient) Delete(ctx context.Context, in *DeleteCategoryRequest,
|
||||
}
|
||||
|
||||
// CategoryServer is the server API for Category service.
|
||||
// All implementations must embed UnimplementedCategoryServer
|
||||
// All implementations should embed UnimplementedCategoryServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// CMS - 分类
|
||||
type CategoryServer interface {
|
||||
// 分类列表
|
||||
Fetch(context.Context, *IdentRequest) (*CategoryListReply, error)
|
||||
Fetch(context.Context, *protobuf.IdentRequest) (*CategoryListReply, error)
|
||||
// 添加分类
|
||||
Create(context.Context, *CategoryItem) (*StatusReply, error)
|
||||
Create(context.Context, *protobuf.CmsCategoryItem) (*protobuf.StatusReply, error)
|
||||
// 修改分类
|
||||
Modify(context.Context, *ModifyCategoryRequest) (*StatusReply, error)
|
||||
Modify(context.Context, *ModifyCategoryRequest) (*protobuf.StatusReply, error)
|
||||
// 删除分类
|
||||
Delete(context.Context, *DeleteCategoryRequest) (*StatusReply, error)
|
||||
mustEmbedUnimplementedCategoryServer()
|
||||
Delete(context.Context, *DeleteCategoryRequest) (*protobuf.StatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedCategoryServer must be embedded to have
|
||||
// UnimplementedCategoryServer should be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedCategoryServer struct{}
|
||||
|
||||
func (UnimplementedCategoryServer) Fetch(context.Context, *IdentRequest) (*CategoryListReply, error) {
|
||||
func (UnimplementedCategoryServer) Fetch(context.Context, *protobuf.IdentRequest) (*CategoryListReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) Create(context.Context, *CategoryItem) (*StatusReply, error) {
|
||||
func (UnimplementedCategoryServer) Create(context.Context, *protobuf.CmsCategoryItem) (*protobuf.StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) Modify(context.Context, *ModifyCategoryRequest) (*StatusReply, error) {
|
||||
func (UnimplementedCategoryServer) Modify(context.Context, *ModifyCategoryRequest) (*protobuf.StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) Delete(context.Context, *DeleteCategoryRequest) (*StatusReply, error) {
|
||||
func (UnimplementedCategoryServer) Delete(context.Context, *DeleteCategoryRequest) (*protobuf.StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) mustEmbedUnimplementedCategoryServer() {}
|
||||
func (UnimplementedCategoryServer) testEmbeddedByValue() {}
|
||||
func (UnimplementedCategoryServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeCategoryServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to CategoryServer will
|
||||
@@ -147,7 +146,7 @@ func RegisterCategoryServer(s grpc.ServiceRegistrar, srv CategoryServer) {
|
||||
}
|
||||
|
||||
func _Category_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(IdentRequest)
|
||||
in := new(protobuf.IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -159,13 +158,13 @@ func _Category_Fetch_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
FullMethod: Category_Fetch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CategoryServer).Fetch(ctx, req.(*IdentRequest))
|
||||
return srv.(CategoryServer).Fetch(ctx, req.(*protobuf.IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Category_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CategoryItem)
|
||||
in := new(protobuf.CmsCategoryItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -177,7 +176,7 @@ func _Category_Create_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
FullMethod: Category_Create_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CategoryServer).Create(ctx, req.(*CategoryItem))
|
||||
return srv.(CategoryServer).Create(ctx, req.(*protobuf.CmsCategoryItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -243,5 +242,5 @@ var Category_ServiceDesc = grpc.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "category.proto",
|
||||
Metadata: "module/base/cms/proto/category.proto",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user