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.5.1
|
||||
// - protoc (unknown)
|
||||
// source: post.proto
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v7.35.0
|
||||
// source: module/social/feed/proto/post.proto
|
||||
|
||||
package feed
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -36,21 +37,21 @@ const (
|
||||
// 推文相关操作
|
||||
type PostClient interface {
|
||||
// 推文列表
|
||||
Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*PostListReply, error)
|
||||
Fetch(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error)
|
||||
// 新建推文
|
||||
Create(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
Create(ctx context.Context, in *protobuf.FeedPostItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
// 修改推文
|
||||
Change(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
Change(ctx context.Context, in *protobuf.FeedPostItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
// 删除推文
|
||||
Remove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
Remove(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
// 评论列表
|
||||
CommentList(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error)
|
||||
CommentList(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error)
|
||||
// 新建评论
|
||||
AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
// 删除评论
|
||||
DeleteComment(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
DeleteComment(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
// 计数操作
|
||||
Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
}
|
||||
|
||||
type postClient struct {
|
||||
@@ -61,9 +62,9 @@ func NewPostClient(cc grpc.ClientConnInterface) PostClient {
|
||||
return &postClient{cc}
|
||||
}
|
||||
|
||||
func (c *postClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*PostListReply, error) {
|
||||
func (c *postClient) Fetch(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PostListReply)
|
||||
out := new(protobuf.FeedPostListReply)
|
||||
err := c.cc.Invoke(ctx, Post_Fetch_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -71,9 +72,9 @@ func (c *postClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.C
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) Create(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *postClient) Create(ctx context.Context, in *protobuf.FeedPostItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -81,9 +82,9 @@ func (c *postClient) Create(ctx context.Context, in *PostItem, opts ...grpc.Call
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) Change(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *postClient) Change(ctx context.Context, in *protobuf.FeedPostItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_Change_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -91,9 +92,9 @@ func (c *postClient) Change(ctx context.Context, in *PostItem, opts ...grpc.Call
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) Remove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *postClient) Remove(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_Remove_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -101,7 +102,7 @@ func (c *postClient) Remove(ctx context.Context, in *IdentRequest, opts ...grpc.
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) CommentList(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error) {
|
||||
func (c *postClient) CommentList(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CommentListReply)
|
||||
err := c.cc.Invoke(ctx, Post_CommentList_FullMethodName, in, out, cOpts...)
|
||||
@@ -111,9 +112,9 @@ func (c *postClient) CommentList(ctx context.Context, in *FetchRequest, opts ...
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *postClient) AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_AddComment_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -121,9 +122,9 @@ func (c *postClient) AddComment(ctx context.Context, in *CommentItem, opts ...gr
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) DeleteComment(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *postClient) DeleteComment(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_DeleteComment_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -131,9 +132,9 @@ func (c *postClient) DeleteComment(ctx context.Context, in *IdentRequest, opts .
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
func (c *postClient) Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_Action_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -142,63 +143,61 @@ func (c *postClient) Action(ctx context.Context, in *PostActionRequest, opts ...
|
||||
}
|
||||
|
||||
// PostServer is the server API for Post service.
|
||||
// All implementations must embed UnimplementedPostServer
|
||||
// All implementations should embed UnimplementedPostServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// 推文相关操作
|
||||
type PostServer interface {
|
||||
// 推文列表
|
||||
Fetch(context.Context, *FetchRequest) (*PostListReply, error)
|
||||
Fetch(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error)
|
||||
// 新建推文
|
||||
Create(context.Context, *PostItem) (*StatusReply, error)
|
||||
Create(context.Context, *protobuf.FeedPostItem) (*protobuf.DataStatusReply, error)
|
||||
// 修改推文
|
||||
Change(context.Context, *PostItem) (*StatusReply, error)
|
||||
Change(context.Context, *protobuf.FeedPostItem) (*protobuf.DataStatusReply, error)
|
||||
// 删除推文
|
||||
Remove(context.Context, *IdentRequest) (*StatusReply, error)
|
||||
Remove(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error)
|
||||
// 评论列表
|
||||
CommentList(context.Context, *FetchRequest) (*CommentListReply, error)
|
||||
CommentList(context.Context, *protobuf.FetchRequest) (*CommentListReply, error)
|
||||
// 新建评论
|
||||
AddComment(context.Context, *CommentItem) (*StatusReply, error)
|
||||
AddComment(context.Context, *CommentItem) (*protobuf.DataStatusReply, error)
|
||||
// 删除评论
|
||||
DeleteComment(context.Context, *IdentRequest) (*StatusReply, error)
|
||||
DeleteComment(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error)
|
||||
// 计数操作
|
||||
Action(context.Context, *PostActionRequest) (*StatusReply, error)
|
||||
mustEmbedUnimplementedPostServer()
|
||||
Action(context.Context, *PostActionRequest) (*protobuf.DataStatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedPostServer must be embedded to have
|
||||
// UnimplementedPostServer 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 UnimplementedPostServer struct{}
|
||||
|
||||
func (UnimplementedPostServer) Fetch(context.Context, *FetchRequest) (*PostListReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented")
|
||||
func (UnimplementedPostServer) Fetch(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) Create(context.Context, *PostItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
|
||||
func (UnimplementedPostServer) Create(context.Context, *protobuf.FeedPostItem) (*protobuf.DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) Change(context.Context, *PostItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Change not implemented")
|
||||
func (UnimplementedPostServer) Change(context.Context, *protobuf.FeedPostItem) (*protobuf.DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Change not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) Remove(context.Context, *IdentRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Remove not implemented")
|
||||
func (UnimplementedPostServer) Remove(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Remove not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) CommentList(context.Context, *FetchRequest) (*CommentListReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CommentList not implemented")
|
||||
func (UnimplementedPostServer) CommentList(context.Context, *protobuf.FetchRequest) (*CommentListReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method CommentList not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) AddComment(context.Context, *CommentItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddComment not implemented")
|
||||
func (UnimplementedPostServer) AddComment(context.Context, *CommentItem) (*protobuf.DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method AddComment not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) DeleteComment(context.Context, *IdentRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteComment not implemented")
|
||||
func (UnimplementedPostServer) DeleteComment(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DeleteComment not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) Action(context.Context, *PostActionRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Action not implemented")
|
||||
func (UnimplementedPostServer) Action(context.Context, *PostActionRequest) (*protobuf.DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Action not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) mustEmbedUnimplementedPostServer() {}
|
||||
func (UnimplementedPostServer) testEmbeddedByValue() {}
|
||||
func (UnimplementedPostServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafePostServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to PostServer will
|
||||
@@ -208,7 +207,7 @@ type UnsafePostServer interface {
|
||||
}
|
||||
|
||||
func RegisterPostServer(s grpc.ServiceRegistrar, srv PostServer) {
|
||||
// If the following call pancis, it indicates UnimplementedPostServer was
|
||||
// If the following call panics, it indicates UnimplementedPostServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
@@ -219,7 +218,7 @@ func RegisterPostServer(s grpc.ServiceRegistrar, srv PostServer) {
|
||||
}
|
||||
|
||||
func _Post_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FetchRequest)
|
||||
in := new(protobuf.FetchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -231,13 +230,13 @@ func _Post_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interfac
|
||||
FullMethod: Post_Fetch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).Fetch(ctx, req.(*FetchRequest))
|
||||
return srv.(PostServer).Fetch(ctx, req.(*protobuf.FetchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostItem)
|
||||
in := new(protobuf.FeedPostItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -249,13 +248,13 @@ func _Post_Create_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
FullMethod: Post_Create_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).Create(ctx, req.(*PostItem))
|
||||
return srv.(PostServer).Create(ctx, req.(*protobuf.FeedPostItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_Change_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostItem)
|
||||
in := new(protobuf.FeedPostItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -267,13 +266,13 @@ func _Post_Change_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
FullMethod: Post_Change_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).Change(ctx, req.(*PostItem))
|
||||
return srv.(PostServer).Change(ctx, req.(*protobuf.FeedPostItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_Remove_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
|
||||
}
|
||||
@@ -285,13 +284,13 @@ func _Post_Remove_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
FullMethod: Post_Remove_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).Remove(ctx, req.(*IdentRequest))
|
||||
return srv.(PostServer).Remove(ctx, req.(*protobuf.IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_CommentList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FetchRequest)
|
||||
in := new(protobuf.FetchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -303,7 +302,7 @@ func _Post_CommentList_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
FullMethod: Post_CommentList_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).CommentList(ctx, req.(*FetchRequest))
|
||||
return srv.(PostServer).CommentList(ctx, req.(*protobuf.FetchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -327,7 +326,7 @@ func _Post_AddComment_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
}
|
||||
|
||||
func _Post_DeleteComment_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
|
||||
}
|
||||
@@ -339,7 +338,7 @@ func _Post_DeleteComment_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
FullMethod: Post_DeleteComment_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).DeleteComment(ctx, req.(*IdentRequest))
|
||||
return srv.(PostServer).DeleteComment(ctx, req.(*protobuf.IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -403,5 +402,5 @@ var Post_ServiceDesc = grpc.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "post.proto",
|
||||
Metadata: "module/social/feed/proto/post.proto",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user