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

@@ -1,14 +1,6 @@
package feed
import blocks "bsm/full/protobuf"
type Empty = blocks.Empty
type FetchRequest = blocks.FetchRequest
type IdentRequest = blocks.IdentRequest
type VersionRequest = blocks.VersionRequest
type SearchRequest = blocks.SearchRequest
type StatusReply = blocks.DataStatusReply
type PostListReply = blocks.FeedPostListReply
type PostItem = blocks.FeedPostItem
type AttachItem = blocks.FeedAttachItem
type TagItem = blocks.FeedTagItem
type PostListReply = FeedPostListReply
type PostItem = FeedPostItem
type AttachItem = FeedAttachItem
type TagItem = FeedTagItem

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,6 @@
package feed
import (
protobuf "bsm/full/protobuf"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -215,7 +214,7 @@ var File_module_social_feed_proto_post_proto protoreflect.FileDescriptor
const file_module_social_feed_proto_post_proto_rawDesc = "" +
"\n" +
"#module/social/feed/proto/post.proto\x12\x04feed\x1a\x15protobuf/blocks.proto\"O\n" +
"#module/social/feed/proto/post.proto\x12\x04feed\x1a$module/social/feed/proto/const.proto\"O\n" +
"\x10CommentListReply\x12%\n" +
"\x04list\x18\x01 \x03(\v2\x11.feed.CommentItemR\x04list\x12\x14\n" +
"\x05total\x18\x02 \x01(\x03R\x05total\"\xc1\x01\n" +
@@ -256,14 +255,14 @@ func file_module_social_feed_proto_post_proto_rawDescGZIP() []byte {
var file_module_social_feed_proto_post_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_module_social_feed_proto_post_proto_goTypes = []any{
(*CommentListReply)(nil), // 0: feed.CommentListReply
(*CommentItem)(nil), // 1: feed.CommentItem
(*PostActionRequest)(nil), // 2: feed.PostActionRequest
(*protobuf.FetchRequest)(nil), // 3: blocks.FetchRequest
(*protobuf.FeedPostItem)(nil), // 4: blocks.FeedPostItem
(*protobuf.IdentRequest)(nil), // 5: blocks.IdentRequest
(*protobuf.FeedPostListReply)(nil), // 6: blocks.FeedPostListReply
(*protobuf.DataStatusReply)(nil), // 7: blocks.DataStatusReply
(*CommentListReply)(nil), // 0: feed.CommentListReply
(*CommentItem)(nil), // 1: feed.CommentItem
(*PostActionRequest)(nil), // 2: feed.PostActionRequest
(*FetchRequest)(nil), // 3: blocks.FetchRequest
(*FeedPostItem)(nil), // 4: blocks.FeedPostItem
(*IdentRequest)(nil), // 5: blocks.IdentRequest
(*FeedPostListReply)(nil), // 6: blocks.FeedPostListReply
(*DataStatusReply)(nil), // 7: blocks.DataStatusReply
}
var file_module_social_feed_proto_post_proto_depIdxs = []int32{
1, // 0: feed.CommentListReply.list:type_name -> feed.CommentItem
@@ -296,6 +295,7 @@ func file_module_social_feed_proto_post_proto_init() {
if File_module_social_feed_proto_post_proto != nil {
return
}
file_module_social_feed_proto_const_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{

View File

@@ -9,7 +9,6 @@ It translates gRPC into RESTful JSON APIs.
package feed
import (
"bsm/full/protobuf"
"context"
"errors"
"io"
@@ -38,7 +37,7 @@ var (
func request_Post_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, client PostClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -53,7 +52,7 @@ func request_Post_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, clie
func local_request_Post_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, server PostServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -65,7 +64,7 @@ func local_request_Post_Fetch_0(ctx context.Context, marshaler runtime.Marshaler
func request_Post_Create_0(ctx context.Context, marshaler runtime.Marshaler, client PostClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FeedPostItem
protoReq FeedPostItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -80,7 +79,7 @@ func request_Post_Create_0(ctx context.Context, marshaler runtime.Marshaler, cli
func local_request_Post_Create_0(ctx context.Context, marshaler runtime.Marshaler, server PostServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FeedPostItem
protoReq FeedPostItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -92,7 +91,7 @@ func local_request_Post_Create_0(ctx context.Context, marshaler runtime.Marshale
func request_Post_Change_0(ctx context.Context, marshaler runtime.Marshaler, client PostClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FeedPostItem
protoReq FeedPostItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -107,7 +106,7 @@ func request_Post_Change_0(ctx context.Context, marshaler runtime.Marshaler, cli
func local_request_Post_Change_0(ctx context.Context, marshaler runtime.Marshaler, server PostServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FeedPostItem
protoReq FeedPostItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -119,7 +118,7 @@ func local_request_Post_Change_0(ctx context.Context, marshaler runtime.Marshale
func request_Post_Remove_0(ctx context.Context, marshaler runtime.Marshaler, client PostClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.IdentRequest
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -134,7 +133,7 @@ func request_Post_Remove_0(ctx context.Context, marshaler runtime.Marshaler, cli
func local_request_Post_Remove_0(ctx context.Context, marshaler runtime.Marshaler, server PostServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.IdentRequest
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -146,7 +145,7 @@ func local_request_Post_Remove_0(ctx context.Context, marshaler runtime.Marshale
func request_Post_CommentList_0(ctx context.Context, marshaler runtime.Marshaler, client PostClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -161,7 +160,7 @@ func request_Post_CommentList_0(ctx context.Context, marshaler runtime.Marshaler
func local_request_Post_CommentList_0(ctx context.Context, marshaler runtime.Marshaler, server PostServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -200,7 +199,7 @@ func local_request_Post_AddComment_0(ctx context.Context, marshaler runtime.Mars
func request_Post_DeleteComment_0(ctx context.Context, marshaler runtime.Marshaler, client PostClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.IdentRequest
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -215,7 +214,7 @@ func request_Post_DeleteComment_0(ctx context.Context, marshaler runtime.Marshal
func local_request_Post_DeleteComment_0(ctx context.Context, marshaler runtime.Marshaler, server PostServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.IdentRequest
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {

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)
}

View File

@@ -7,7 +7,6 @@
package feed
import (
protobuf "bsm/full/protobuf"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -25,13 +24,13 @@ var File_module_social_feed_proto_setting_proto protoreflect.FileDescriptor
const file_module_social_feed_proto_setting_proto_rawDesc = "" +
"\n" +
"&module/social/feed/proto/setting.proto\x12\x04feed\x1a\x15protobuf/blocks.proto2[\n" +
"&module/social/feed/proto/setting.proto\x12\x04feed\x1a$module/social/feed/proto/const.proto2[\n" +
"\aSetting\x12&\n" +
"\x04Info\x12\r.blocks.Empty\x1a\r.blocks.Empty\"\x00\x12(\n" +
"\x06Rights\x12\r.blocks.Empty\x1a\r.blocks.Empty\"\x00B%Z#bsm/full/module/social/feed/pb;feedb\x06proto3"
var file_module_social_feed_proto_setting_proto_goTypes = []any{
(*protobuf.Empty)(nil), // 0: blocks.Empty
(*Empty)(nil), // 0: blocks.Empty
}
var file_module_social_feed_proto_setting_proto_depIdxs = []int32{
0, // 0: feed.Setting.Info:input_type -> blocks.Empty
@@ -50,6 +49,7 @@ func file_module_social_feed_proto_setting_proto_init() {
if File_module_social_feed_proto_setting_proto != nil {
return
}
file_module_social_feed_proto_const_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{

View File

@@ -9,7 +9,6 @@ It translates gRPC into RESTful JSON APIs.
package feed
import (
"bsm/full/protobuf"
"context"
"errors"
"io"
@@ -38,7 +37,7 @@ var (
func request_Setting_Info_0(ctx context.Context, marshaler runtime.Marshaler, client SettingClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.Empty
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -53,7 +52,7 @@ func request_Setting_Info_0(ctx context.Context, marshaler runtime.Marshaler, cl
func local_request_Setting_Info_0(ctx context.Context, marshaler runtime.Marshaler, server SettingServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.Empty
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -65,7 +64,7 @@ func local_request_Setting_Info_0(ctx context.Context, marshaler runtime.Marshal
func request_Setting_Rights_0(ctx context.Context, marshaler runtime.Marshaler, client SettingClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.Empty
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -80,7 +79,7 @@ func request_Setting_Rights_0(ctx context.Context, marshaler runtime.Marshaler,
func local_request_Setting_Rights_0(ctx context.Context, marshaler runtime.Marshaler, server SettingServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.Empty
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {

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"
@@ -29,9 +28,9 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SettingClient interface {
// 修改个人信息
Info(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*protobuf.Empty, error)
Info(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
// 修改权限信息
Rights(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*protobuf.Empty, error)
Rights(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
}
type settingClient struct {
@@ -42,9 +41,9 @@ func NewSettingClient(cc grpc.ClientConnInterface) SettingClient {
return &settingClient{cc}
}
func (c *settingClient) Info(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*protobuf.Empty, error) {
func (c *settingClient) Info(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.Empty)
out := new(Empty)
err := c.cc.Invoke(ctx, Setting_Info_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -52,9 +51,9 @@ func (c *settingClient) Info(ctx context.Context, in *protobuf.Empty, opts ...gr
return out, nil
}
func (c *settingClient) Rights(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*protobuf.Empty, error) {
func (c *settingClient) Rights(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.Empty)
out := new(Empty)
err := c.cc.Invoke(ctx, Setting_Rights_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -67,9 +66,9 @@ func (c *settingClient) Rights(ctx context.Context, in *protobuf.Empty, opts ...
// for forward compatibility.
type SettingServer interface {
// 修改个人信息
Info(context.Context, *protobuf.Empty) (*protobuf.Empty, error)
Info(context.Context, *Empty) (*Empty, error)
// 修改权限信息
Rights(context.Context, *protobuf.Empty) (*protobuf.Empty, error)
Rights(context.Context, *Empty) (*Empty, error)
}
// UnimplementedSettingServer should be embedded to have
@@ -79,10 +78,10 @@ type SettingServer interface {
// pointer dereference when methods are called.
type UnimplementedSettingServer struct{}
func (UnimplementedSettingServer) Info(context.Context, *protobuf.Empty) (*protobuf.Empty, error) {
func (UnimplementedSettingServer) Info(context.Context, *Empty) (*Empty, error) {
return nil, status.Error(codes.Unimplemented, "method Info not implemented")
}
func (UnimplementedSettingServer) Rights(context.Context, *protobuf.Empty) (*protobuf.Empty, error) {
func (UnimplementedSettingServer) Rights(context.Context, *Empty) (*Empty, error) {
return nil, status.Error(codes.Unimplemented, "method Rights not implemented")
}
func (UnimplementedSettingServer) testEmbeddedByValue() {}
@@ -106,7 +105,7 @@ func RegisterSettingServer(s grpc.ServiceRegistrar, srv SettingServer) {
}
func _Setting_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(protobuf.Empty)
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
@@ -118,13 +117,13 @@ func _Setting_Info_Handler(srv interface{}, ctx context.Context, dec func(interf
FullMethod: Setting_Info_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SettingServer).Info(ctx, req.(*protobuf.Empty))
return srv.(SettingServer).Info(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Setting_Rights_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(protobuf.Empty)
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
@@ -136,7 +135,7 @@ func _Setting_Rights_Handler(srv interface{}, ctx context.Context, dec func(inte
FullMethod: Setting_Rights_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SettingServer).Rights(ctx, req.(*protobuf.Empty))
return srv.(SettingServer).Rights(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}

View File

@@ -7,7 +7,6 @@
package feed
import (
protobuf "bsm/full/protobuf"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -67,9 +66,9 @@ func (x *AddTagRequest) GetTags() []string {
}
type TagListReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Tags []*protobuf.FeedTagItem `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"`
Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
state protoimpl.MessageState `protogen:"open.v1"`
Tags []*FeedTagItem `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"`
Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -104,7 +103,7 @@ func (*TagListReply) Descriptor() ([]byte, []int) {
return file_module_social_feed_proto_tag_proto_rawDescGZIP(), []int{1}
}
func (x *TagListReply) GetTags() []*protobuf.FeedTagItem {
func (x *TagListReply) GetTags() []*FeedTagItem {
if x != nil {
return x.Tags
}
@@ -122,7 +121,7 @@ var File_module_social_feed_proto_tag_proto protoreflect.FileDescriptor
const file_module_social_feed_proto_tag_proto_rawDesc = "" +
"\n" +
"\"module/social/feed/proto/tag.proto\x12\x04feed\x1a\x15protobuf/blocks.proto\"#\n" +
"\"module/social/feed/proto/tag.proto\x12\x04feed\x1a$module/social/feed/proto/const.proto\"#\n" +
"\rAddTagRequest\x12\x12\n" +
"\x04tags\x18\x01 \x03(\tR\x04tags\"M\n" +
"\fTagListReply\x12'\n" +
@@ -147,12 +146,12 @@ func file_module_social_feed_proto_tag_proto_rawDescGZIP() []byte {
var file_module_social_feed_proto_tag_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_module_social_feed_proto_tag_proto_goTypes = []any{
(*AddTagRequest)(nil), // 0: feed.AddTagRequest
(*TagListReply)(nil), // 1: feed.TagListReply
(*protobuf.FeedTagItem)(nil), // 2: blocks.FeedTagItem
(*protobuf.FetchRequest)(nil), // 3: blocks.FetchRequest
(*protobuf.DataStatusReply)(nil), // 4: blocks.DataStatusReply
(*protobuf.FeedPostListReply)(nil), // 5: blocks.FeedPostListReply
(*AddTagRequest)(nil), // 0: feed.AddTagRequest
(*TagListReply)(nil), // 1: feed.TagListReply
(*FeedTagItem)(nil), // 2: blocks.FeedTagItem
(*FetchRequest)(nil), // 3: blocks.FetchRequest
(*DataStatusReply)(nil), // 4: blocks.DataStatusReply
(*FeedPostListReply)(nil), // 5: blocks.FeedPostListReply
}
var file_module_social_feed_proto_tag_proto_depIdxs = []int32{
2, // 0: feed.TagListReply.tags:type_name -> blocks.FeedTagItem
@@ -174,6 +173,7 @@ func file_module_social_feed_proto_tag_proto_init() {
if File_module_social_feed_proto_tag_proto != nil {
return
}
file_module_social_feed_proto_const_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{

View File

@@ -9,7 +9,6 @@ It translates gRPC into RESTful JSON APIs.
package feed
import (
"bsm/full/protobuf"
"context"
"errors"
"io"
@@ -38,7 +37,7 @@ var (
func request_Tag_List_0(ctx context.Context, marshaler runtime.Marshaler, client TagClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -53,7 +52,7 @@ func request_Tag_List_0(ctx context.Context, marshaler runtime.Marshaler, client
func local_request_Tag_List_0(ctx context.Context, marshaler runtime.Marshaler, server TagServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -92,7 +91,7 @@ func local_request_Tag_Create_0(ctx context.Context, marshaler runtime.Marshaler
func request_Tag_PostList_0(ctx context.Context, marshaler runtime.Marshaler, client TagClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -107,7 +106,7 @@ func request_Tag_PostList_0(ctx context.Context, marshaler runtime.Marshaler, cl
func local_request_Tag_PostList_0(ctx context.Context, marshaler runtime.Marshaler, server TagServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {

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"
@@ -30,11 +29,11 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type TagClient interface {
// 标签列表
List(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*TagListReply, error)
List(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*TagListReply, error)
// 新建标签
Create(ctx context.Context, in *AddTagRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
Create(ctx context.Context, in *AddTagRequest, opts ...grpc.CallOption) (*DataStatusReply, error)
// 话题相关的文章
PostList(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error)
PostList(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FeedPostListReply, error)
}
type tagClient struct {
@@ -45,7 +44,7 @@ func NewTagClient(cc grpc.ClientConnInterface) TagClient {
return &tagClient{cc}
}
func (c *tagClient) List(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*TagListReply, error) {
func (c *tagClient) List(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*TagListReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(TagListReply)
err := c.cc.Invoke(ctx, Tag_List_FullMethodName, in, out, cOpts...)
@@ -55,9 +54,9 @@ func (c *tagClient) List(ctx context.Context, in *protobuf.FetchRequest, opts ..
return out, nil
}
func (c *tagClient) Create(ctx context.Context, in *AddTagRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
func (c *tagClient) Create(ctx context.Context, in *AddTagRequest, opts ...grpc.CallOption) (*DataStatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.DataStatusReply)
out := new(DataStatusReply)
err := c.cc.Invoke(ctx, Tag_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -65,9 +64,9 @@ func (c *tagClient) Create(ctx context.Context, in *AddTagRequest, opts ...grpc.
return out, nil
}
func (c *tagClient) PostList(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error) {
func (c *tagClient) PostList(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, Tag_PostList_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -80,11 +79,11 @@ func (c *tagClient) PostList(ctx context.Context, in *protobuf.FetchRequest, opt
// for forward compatibility.
type TagServer interface {
// 标签列表
List(context.Context, *protobuf.FetchRequest) (*TagListReply, error)
List(context.Context, *FetchRequest) (*TagListReply, error)
// 新建标签
Create(context.Context, *AddTagRequest) (*protobuf.DataStatusReply, error)
Create(context.Context, *AddTagRequest) (*DataStatusReply, error)
// 话题相关的文章
PostList(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error)
PostList(context.Context, *FetchRequest) (*FeedPostListReply, error)
}
// UnimplementedTagServer should be embedded to have
@@ -94,13 +93,13 @@ type TagServer interface {
// pointer dereference when methods are called.
type UnimplementedTagServer struct{}
func (UnimplementedTagServer) List(context.Context, *protobuf.FetchRequest) (*TagListReply, error) {
func (UnimplementedTagServer) List(context.Context, *FetchRequest) (*TagListReply, error) {
return nil, status.Error(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedTagServer) Create(context.Context, *AddTagRequest) (*protobuf.DataStatusReply, error) {
func (UnimplementedTagServer) Create(context.Context, *AddTagRequest) (*DataStatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedTagServer) PostList(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error) {
func (UnimplementedTagServer) PostList(context.Context, *FetchRequest) (*FeedPostListReply, error) {
return nil, status.Error(codes.Unimplemented, "method PostList not implemented")
}
func (UnimplementedTagServer) testEmbeddedByValue() {}
@@ -124,7 +123,7 @@ func RegisterTagServer(s grpc.ServiceRegistrar, srv TagServer) {
}
func _Tag_List_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
}
@@ -136,7 +135,7 @@ func _Tag_List_Handler(srv interface{}, ctx context.Context, dec func(interface{
FullMethod: Tag_List_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TagServer).List(ctx, req.(*protobuf.FetchRequest))
return srv.(TagServer).List(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -160,7 +159,7 @@ func _Tag_Create_Handler(srv interface{}, ctx context.Context, dec func(interfac
}
func _Tag_PostList_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
}
@@ -172,7 +171,7 @@ func _Tag_PostList_Handler(srv interface{}, ctx context.Context, dec func(interf
FullMethod: Tag_PostList_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TagServer).PostList(ctx, req.(*protobuf.FetchRequest))
return srv.(TagServer).PostList(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}

View File

@@ -7,7 +7,6 @@
package feed
import (
protobuf "bsm/full/protobuf"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -25,7 +24,7 @@ var File_module_social_feed_proto_timeline_proto protoreflect.FileDescriptor
const file_module_social_feed_proto_timeline_proto_rawDesc = "" +
"\n" +
"'module/social/feed/proto/timeline.proto\x12\x04feed\x1a\x15protobuf/blocks.proto2\xfe\x01\n" +
"'module/social/feed/proto/timeline.proto\x12\x04feed\x1a$module/social/feed/proto/const.proto2\xfe\x01\n" +
"\bTimeline\x12>\n" +
"\tRecommend\x12\x14.blocks.FetchRequest\x1a\x19.blocks.FeedPostListReply\"\x00\x12;\n" +
"\x06Friend\x12\x14.blocks.FetchRequest\x1a\x19.blocks.FeedPostListReply\"\x00\x12;\n" +
@@ -33,8 +32,8 @@ const file_module_social_feed_proto_timeline_proto_rawDesc = "" +
"\x03Hot\x12\x14.blocks.FetchRequest\x1a\x19.blocks.FeedPostListReply\"\x00B%Z#bsm/full/module/social/feed/pb;feedb\x06proto3"
var file_module_social_feed_proto_timeline_proto_goTypes = []any{
(*protobuf.FetchRequest)(nil), // 0: blocks.FetchRequest
(*protobuf.FeedPostListReply)(nil), // 1: blocks.FeedPostListReply
(*FetchRequest)(nil), // 0: blocks.FetchRequest
(*FeedPostListReply)(nil), // 1: blocks.FeedPostListReply
}
var file_module_social_feed_proto_timeline_proto_depIdxs = []int32{
0, // 0: feed.Timeline.Recommend:input_type -> blocks.FetchRequest
@@ -57,6 +56,7 @@ func file_module_social_feed_proto_timeline_proto_init() {
if File_module_social_feed_proto_timeline_proto != nil {
return
}
file_module_social_feed_proto_const_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{

View File

@@ -9,7 +9,6 @@ It translates gRPC into RESTful JSON APIs.
package feed
import (
"bsm/full/protobuf"
"context"
"errors"
"io"
@@ -38,7 +37,7 @@ var (
func request_Timeline_Recommend_0(ctx context.Context, marshaler runtime.Marshaler, client TimelineClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -53,7 +52,7 @@ func request_Timeline_Recommend_0(ctx context.Context, marshaler runtime.Marshal
func local_request_Timeline_Recommend_0(ctx context.Context, marshaler runtime.Marshaler, server TimelineServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -65,7 +64,7 @@ func local_request_Timeline_Recommend_0(ctx context.Context, marshaler runtime.M
func request_Timeline_Friend_0(ctx context.Context, marshaler runtime.Marshaler, client TimelineClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -80,7 +79,7 @@ func request_Timeline_Friend_0(ctx context.Context, marshaler runtime.Marshaler,
func local_request_Timeline_Friend_0(ctx context.Context, marshaler runtime.Marshaler, server TimelineServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -92,7 +91,7 @@ func local_request_Timeline_Friend_0(ctx context.Context, marshaler runtime.Mars
func request_Timeline_Follow_0(ctx context.Context, marshaler runtime.Marshaler, client TimelineClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -107,7 +106,7 @@ func request_Timeline_Follow_0(ctx context.Context, marshaler runtime.Marshaler,
func local_request_Timeline_Follow_0(ctx context.Context, marshaler runtime.Marshaler, server TimelineServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -119,7 +118,7 @@ func local_request_Timeline_Follow_0(ctx context.Context, marshaler runtime.Mars
func request_Timeline_Hot_0(ctx context.Context, marshaler runtime.Marshaler, client TimelineClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
@@ -134,7 +133,7 @@ func request_Timeline_Hot_0(ctx context.Context, marshaler runtime.Marshaler, cl
func local_request_Timeline_Hot_0(ctx context.Context, marshaler runtime.Marshaler, server TimelineServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq blocks.FetchRequest
protoReq FetchRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {

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"
@@ -33,13 +32,13 @@ const (
// 实时动态
type TimelineClient interface {
// 推荐
Recommend(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error)
Recommend(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FeedPostListReply, error)
// 好友动态
Friend(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error)
Friend(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FeedPostListReply, error)
// 关注的动态
Follow(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error)
Follow(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FeedPostListReply, error)
// 热门
Hot(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error)
Hot(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FeedPostListReply, error)
}
type timelineClient struct {
@@ -50,9 +49,9 @@ func NewTimelineClient(cc grpc.ClientConnInterface) TimelineClient {
return &timelineClient{cc}
}
func (c *timelineClient) Recommend(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error) {
func (c *timelineClient) Recommend(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, Timeline_Recommend_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -60,9 +59,9 @@ func (c *timelineClient) Recommend(ctx context.Context, in *protobuf.FetchReques
return out, nil
}
func (c *timelineClient) Friend(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error) {
func (c *timelineClient) Friend(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, Timeline_Friend_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -70,9 +69,9 @@ func (c *timelineClient) Friend(ctx context.Context, in *protobuf.FetchRequest,
return out, nil
}
func (c *timelineClient) Follow(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error) {
func (c *timelineClient) Follow(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, Timeline_Follow_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -80,9 +79,9 @@ func (c *timelineClient) Follow(ctx context.Context, in *protobuf.FetchRequest,
return out, nil
}
func (c *timelineClient) Hot(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FeedPostListReply, error) {
func (c *timelineClient) Hot(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, Timeline_Hot_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -97,13 +96,13 @@ func (c *timelineClient) Hot(ctx context.Context, in *protobuf.FetchRequest, opt
// 实时动态
type TimelineServer interface {
// 推荐
Recommend(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error)
Recommend(context.Context, *FetchRequest) (*FeedPostListReply, error)
// 好友动态
Friend(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error)
Friend(context.Context, *FetchRequest) (*FeedPostListReply, error)
// 关注的动态
Follow(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error)
Follow(context.Context, *FetchRequest) (*FeedPostListReply, error)
// 热门
Hot(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error)
Hot(context.Context, *FetchRequest) (*FeedPostListReply, error)
}
// UnimplementedTimelineServer should be embedded to have
@@ -113,16 +112,16 @@ type TimelineServer interface {
// pointer dereference when methods are called.
type UnimplementedTimelineServer struct{}
func (UnimplementedTimelineServer) Recommend(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error) {
func (UnimplementedTimelineServer) Recommend(context.Context, *FetchRequest) (*FeedPostListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Recommend not implemented")
}
func (UnimplementedTimelineServer) Friend(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error) {
func (UnimplementedTimelineServer) Friend(context.Context, *FetchRequest) (*FeedPostListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Friend not implemented")
}
func (UnimplementedTimelineServer) Follow(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error) {
func (UnimplementedTimelineServer) Follow(context.Context, *FetchRequest) (*FeedPostListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Follow not implemented")
}
func (UnimplementedTimelineServer) Hot(context.Context, *protobuf.FetchRequest) (*protobuf.FeedPostListReply, error) {
func (UnimplementedTimelineServer) Hot(context.Context, *FetchRequest) (*FeedPostListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Hot not implemented")
}
func (UnimplementedTimelineServer) testEmbeddedByValue() {}
@@ -146,7 +145,7 @@ func RegisterTimelineServer(s grpc.ServiceRegistrar, srv TimelineServer) {
}
func _Timeline_Recommend_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
}
@@ -158,13 +157,13 @@ func _Timeline_Recommend_Handler(srv interface{}, ctx context.Context, dec func(
FullMethod: Timeline_Recommend_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TimelineServer).Recommend(ctx, req.(*protobuf.FetchRequest))
return srv.(TimelineServer).Recommend(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Timeline_Friend_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
}
@@ -176,13 +175,13 @@ func _Timeline_Friend_Handler(srv interface{}, ctx context.Context, dec func(int
FullMethod: Timeline_Friend_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TimelineServer).Friend(ctx, req.(*protobuf.FetchRequest))
return srv.(TimelineServer).Friend(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Timeline_Follow_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
}
@@ -194,13 +193,13 @@ func _Timeline_Follow_Handler(srv interface{}, ctx context.Context, dec func(int
FullMethod: Timeline_Follow_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TimelineServer).Follow(ctx, req.(*protobuf.FetchRequest))
return srv.(TimelineServer).Follow(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Timeline_Hot_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
}
@@ -212,7 +211,7 @@ func _Timeline_Hot_Handler(srv interface{}, ctx context.Context, dec func(interf
FullMethod: Timeline_Hot_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TimelineServer).Hot(ctx, req.(*protobuf.FetchRequest))
return srv.(TimelineServer).Hot(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}