refactor: localize protobuf definitions

This commit is contained in:
2026-08-09 20:14:57 +08:00
parent 9f6f318bbb
commit 5ea45a76fe
429 changed files with 54058 additions and 61623 deletions

View File

@@ -7,7 +7,6 @@
package feed
import (
protobuf "bsm/full/protobuf"
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
@@ -37,21 +36,21 @@ const (
// 推文相关操作
type PostClient interface {
// 推文列表
Fetch(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error)
Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FeedPostListReply, error)
// 新建推文
Create(ctx context.Context, in *protobuf.FeedPostItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
Create(ctx context.Context, in *FeedPostItem, opts ...grpc.CallOption) (*DataStatusReply, error)
// 修改推文
Change(ctx context.Context, in *protobuf.FeedPostItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
Change(ctx context.Context, in *FeedPostItem, opts ...grpc.CallOption) (*DataStatusReply, error)
// 删除推文
Remove(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
Remove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error)
// 评论列表
CommentList(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error)
CommentList(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error)
// 新建评论
AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*DataStatusReply, error)
// 删除评论
DeleteComment(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
DeleteComment(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error)
// 计数操作
Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*DataStatusReply, error)
}
type postClient struct {
@@ -62,9 +61,9 @@ func NewPostClient(cc grpc.ClientConnInterface) PostClient {
return &postClient{cc}
}
func (c *postClient) Fetch(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error) {
func (c *postClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FeedPostListReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.FeedPostListReply)
out := new(FeedPostListReply)
err := c.cc.Invoke(ctx, Post_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -72,9 +71,9 @@ func (c *postClient) Fetch(ctx context.Context, in *protobuf.FetchRequest, opts
return out, nil
}
func (c *postClient) Create(ctx context.Context, in *protobuf.FeedPostItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
func (c *postClient) Create(ctx context.Context, in *FeedPostItem, opts ...grpc.CallOption) (*DataStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.DataStatusReply)
out := new(DataStatusReply)
err := c.cc.Invoke(ctx, Post_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -82,9 +81,9 @@ func (c *postClient) Create(ctx context.Context, in *protobuf.FeedPostItem, opts
return out, nil
}
func (c *postClient) Change(ctx context.Context, in *protobuf.FeedPostItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
func (c *postClient) Change(ctx context.Context, in *FeedPostItem, opts ...grpc.CallOption) (*DataStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.DataStatusReply)
out := new(DataStatusReply)
err := c.cc.Invoke(ctx, Post_Change_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -92,9 +91,9 @@ func (c *postClient) Change(ctx context.Context, in *protobuf.FeedPostItem, opts
return out, nil
}
func (c *postClient) Remove(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
func (c *postClient) Remove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.DataStatusReply)
out := new(DataStatusReply)
err := c.cc.Invoke(ctx, Post_Remove_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -102,7 +101,7 @@ func (c *postClient) Remove(ctx context.Context, in *protobuf.IdentRequest, opts
return out, nil
}
func (c *postClient) CommentList(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*CommentListReply, error) {
func (c *postClient) CommentList(ctx context.Context, in *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...)
@@ -112,9 +111,9 @@ func (c *postClient) CommentList(ctx context.Context, in *protobuf.FetchRequest,
return out, nil
}
func (c *postClient) AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
func (c *postClient) AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*DataStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.DataStatusReply)
out := new(DataStatusReply)
err := c.cc.Invoke(ctx, Post_AddComment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -122,9 +121,9 @@ func (c *postClient) AddComment(ctx context.Context, in *CommentItem, opts ...gr
return out, nil
}
func (c *postClient) DeleteComment(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
func (c *postClient) DeleteComment(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.DataStatusReply)
out := new(DataStatusReply)
err := c.cc.Invoke(ctx, Post_DeleteComment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -132,9 +131,9 @@ func (c *postClient) DeleteComment(ctx context.Context, in *protobuf.IdentReques
return out, nil
}
func (c *postClient) Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
func (c *postClient) Action(ctx context.Context, in *PostActionRequest, opts ...grpc.CallOption) (*DataStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.DataStatusReply)
out := new(DataStatusReply)
err := c.cc.Invoke(ctx, Post_Action_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -149,21 +148,21 @@ func (c *postClient) Action(ctx context.Context, in *PostActionRequest, opts ...
// 推文相关操作
type PostServer interface {
// 推文列表
Fetch(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error)
Fetch(context.Context, *FetchRequest) (*FeedPostListReply, error)
// 新建推文
Create(context.Context, *protobuf.FeedPostItem) (*protobuf.DataStatusReply, error)
Create(context.Context, *FeedPostItem) (*DataStatusReply, error)
// 修改推文
Change(context.Context, *protobuf.FeedPostItem) (*protobuf.DataStatusReply, error)
Change(context.Context, *FeedPostItem) (*DataStatusReply, error)
// 删除推文
Remove(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error)
Remove(context.Context, *IdentRequest) (*DataStatusReply, error)
// 评论列表
CommentList(context.Context, *protobuf.FetchRequest) (*CommentListReply, error)
CommentList(context.Context, *FetchRequest) (*CommentListReply, error)
// 新建评论
AddComment(context.Context, *CommentItem) (*protobuf.DataStatusReply, error)
AddComment(context.Context, *CommentItem) (*DataStatusReply, error)
// 删除评论
DeleteComment(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error)
DeleteComment(context.Context, *IdentRequest) (*DataStatusReply, error)
// 计数操作
Action(context.Context, *PostActionRequest) (*protobuf.DataStatusReply, error)
Action(context.Context, *PostActionRequest) (*DataStatusReply, error)
}
// UnimplementedPostServer should be embedded to have
@@ -173,28 +172,28 @@ type PostServer interface {
// pointer dereference when methods are called.
type UnimplementedPostServer struct{}
func (UnimplementedPostServer) Fetch(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error) {
func (UnimplementedPostServer) Fetch(context.Context, *FetchRequest) (*FeedPostListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedPostServer) Create(context.Context, *protobuf.FeedPostItem) (*protobuf.DataStatusReply, error) {
func (UnimplementedPostServer) Create(context.Context, *FeedPostItem) (*DataStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedPostServer) Change(context.Context, *protobuf.FeedPostItem) (*protobuf.DataStatusReply, error) {
func (UnimplementedPostServer) Change(context.Context, *FeedPostItem) (*DataStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Change not implemented")
}
func (UnimplementedPostServer) Remove(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error) {
func (UnimplementedPostServer) Remove(context.Context, *IdentRequest) (*DataStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Remove not implemented")
}
func (UnimplementedPostServer) CommentList(context.Context, *protobuf.FetchRequest) (*CommentListReply, error) {
func (UnimplementedPostServer) CommentList(context.Context, *FetchRequest) (*CommentListReply, error) {
return nil, status.Error(codes.Unimplemented, "method CommentList not implemented")
}
func (UnimplementedPostServer) AddComment(context.Context, *CommentItem) (*protobuf.DataStatusReply, error) {
func (UnimplementedPostServer) AddComment(context.Context, *CommentItem) (*DataStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method AddComment not implemented")
}
func (UnimplementedPostServer) DeleteComment(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error) {
func (UnimplementedPostServer) DeleteComment(context.Context, *IdentRequest) (*DataStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteComment not implemented")
}
func (UnimplementedPostServer) Action(context.Context, *PostActionRequest) (*protobuf.DataStatusReply, error) {
func (UnimplementedPostServer) Action(context.Context, *PostActionRequest) (*DataStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Action not implemented")
}
func (UnimplementedPostServer) testEmbeddedByValue() {}
@@ -218,7 +217,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(protobuf.FetchRequest)
in := new(FetchRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -230,13 +229,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.(*protobuf.FetchRequest))
return srv.(PostServer).Fetch(ctx, req.(*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(protobuf.FeedPostItem)
in := new(FeedPostItem)
if err := dec(in); err != nil {
return nil, err
}
@@ -248,13 +247,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.(*protobuf.FeedPostItem))
return srv.(PostServer).Create(ctx, req.(*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(protobuf.FeedPostItem)
in := new(FeedPostItem)
if err := dec(in); err != nil {
return nil, err
}
@@ -266,13 +265,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.(*protobuf.FeedPostItem))
return srv.(PostServer).Change(ctx, req.(*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(protobuf.IdentRequest)
in := new(IdentRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -284,13 +283,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.(*protobuf.IdentRequest))
return srv.(PostServer).Remove(ctx, req.(*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(protobuf.FetchRequest)
in := new(FetchRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -302,7 +301,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.(*protobuf.FetchRequest))
return srv.(PostServer).CommentList(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -326,7 +325,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(protobuf.IdentRequest)
in := new(IdentRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -338,7 +337,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.(*protobuf.IdentRequest))
return srv.(PostServer).DeleteComment(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}