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