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 cloud
import (
protobuf "bsm/full/protobuf"
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
@@ -39,25 +38,25 @@ const (
// 笔记服务
type NoteClient interface {
// 创建笔记
CreateNote(ctx context.Context, in *CreateNoteRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
CreateNote(ctx context.Context, in *CreateNoteRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 获取笔记详情
GetNote(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*CloudNoteItem, error)
GetNote(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*CloudNoteItem, error)
// 更新笔记
UpdateNote(ctx context.Context, in *CloudNoteItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
UpdateNote(ctx context.Context, in *CloudNoteItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除笔记
DeleteNote(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
DeleteNote(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 获取笔记列表
ListNotes(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*ListNotesResponse, error)
ListNotes(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*ListNotesResponse, error)
// 置顶/取消置顶笔记
TogglePin(ctx context.Context, in *TogglePinRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
TogglePin(ctx context.Context, in *TogglePinRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 增加浏览次数
IncrementViews(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
IncrementViews(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 搜索笔记
SearchNotes(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*ListNotesResponse, error)
SearchNotes(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*ListNotesResponse, error)
// 上传附件
InsertAttachment(ctx context.Context, in *NoteAttachmentItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
InsertAttachment(ctx context.Context, in *NoteAttachmentItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除附件
DeleteAttachment(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
DeleteAttachment(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
}
type noteClient struct {
@@ -68,9 +67,9 @@ func NewNoteClient(cc grpc.ClientConnInterface) NoteClient {
return &noteClient{cc}
}
func (c *noteClient) CreateNote(ctx context.Context, in *CreateNoteRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
func (c *noteClient) CreateNote(ctx context.Context, in *CreateNoteRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.StatusReply)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Note_CreateNote_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -78,7 +77,7 @@ func (c *noteClient) CreateNote(ctx context.Context, in *CreateNoteRequest, opts
return out, nil
}
func (c *noteClient) GetNote(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*CloudNoteItem, error) {
func (c *noteClient) GetNote(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*CloudNoteItem, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CloudNoteItem)
err := c.cc.Invoke(ctx, Note_GetNote_FullMethodName, in, out, cOpts...)
@@ -88,9 +87,9 @@ func (c *noteClient) GetNote(ctx context.Context, in *protobuf.IdentRequest, opt
return out, nil
}
func (c *noteClient) UpdateNote(ctx context.Context, in *CloudNoteItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
func (c *noteClient) UpdateNote(ctx context.Context, in *CloudNoteItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.StatusReply)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Note_UpdateNote_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -98,9 +97,9 @@ func (c *noteClient) UpdateNote(ctx context.Context, in *CloudNoteItem, opts ...
return out, nil
}
func (c *noteClient) DeleteNote(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
func (c *noteClient) DeleteNote(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.StatusReply)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Note_DeleteNote_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -108,7 +107,7 @@ func (c *noteClient) DeleteNote(ctx context.Context, in *protobuf.IdentRequest,
return out, nil
}
func (c *noteClient) ListNotes(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*ListNotesResponse, error) {
func (c *noteClient) ListNotes(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*ListNotesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListNotesResponse)
err := c.cc.Invoke(ctx, Note_ListNotes_FullMethodName, in, out, cOpts...)
@@ -118,9 +117,9 @@ func (c *noteClient) ListNotes(ctx context.Context, in *protobuf.FetchRequest, o
return out, nil
}
func (c *noteClient) TogglePin(ctx context.Context, in *TogglePinRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
func (c *noteClient) TogglePin(ctx context.Context, in *TogglePinRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.StatusReply)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Note_TogglePin_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -128,9 +127,9 @@ func (c *noteClient) TogglePin(ctx context.Context, in *TogglePinRequest, opts .
return out, nil
}
func (c *noteClient) IncrementViews(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
func (c *noteClient) IncrementViews(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.StatusReply)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Note_IncrementViews_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -138,7 +137,7 @@ func (c *noteClient) IncrementViews(ctx context.Context, in *protobuf.IdentReque
return out, nil
}
func (c *noteClient) SearchNotes(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*ListNotesResponse, error) {
func (c *noteClient) SearchNotes(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*ListNotesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListNotesResponse)
err := c.cc.Invoke(ctx, Note_SearchNotes_FullMethodName, in, out, cOpts...)
@@ -148,9 +147,9 @@ func (c *noteClient) SearchNotes(ctx context.Context, in *protobuf.FetchRequest,
return out, nil
}
func (c *noteClient) InsertAttachment(ctx context.Context, in *NoteAttachmentItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
func (c *noteClient) InsertAttachment(ctx context.Context, in *NoteAttachmentItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.StatusReply)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Note_InsertAttachment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -158,9 +157,9 @@ func (c *noteClient) InsertAttachment(ctx context.Context, in *NoteAttachmentIte
return out, nil
}
func (c *noteClient) DeleteAttachment(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
func (c *noteClient) DeleteAttachment(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(protobuf.StatusReply)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Note_DeleteAttachment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
@@ -175,25 +174,25 @@ func (c *noteClient) DeleteAttachment(ctx context.Context, in *protobuf.IdentReq
// 笔记服务
type NoteServer interface {
// 创建笔记
CreateNote(context.Context, *CreateNoteRequest) (*protobuf.StatusReply, error)
CreateNote(context.Context, *CreateNoteRequest) (*StatusReply, error)
// 获取笔记详情
GetNote(context.Context, *protobuf.IdentRequest) (*CloudNoteItem, error)
GetNote(context.Context, *IdentRequest) (*CloudNoteItem, error)
// 更新笔记
UpdateNote(context.Context, *CloudNoteItem) (*protobuf.StatusReply, error)
UpdateNote(context.Context, *CloudNoteItem) (*StatusReply, error)
// 删除笔记
DeleteNote(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error)
DeleteNote(context.Context, *IdentRequest) (*StatusReply, error)
// 获取笔记列表
ListNotes(context.Context, *protobuf.FetchRequest) (*ListNotesResponse, error)
ListNotes(context.Context, *FetchRequest) (*ListNotesResponse, error)
// 置顶/取消置顶笔记
TogglePin(context.Context, *TogglePinRequest) (*protobuf.StatusReply, error)
TogglePin(context.Context, *TogglePinRequest) (*StatusReply, error)
// 增加浏览次数
IncrementViews(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error)
IncrementViews(context.Context, *IdentRequest) (*StatusReply, error)
// 搜索笔记
SearchNotes(context.Context, *protobuf.FetchRequest) (*ListNotesResponse, error)
SearchNotes(context.Context, *FetchRequest) (*ListNotesResponse, error)
// 上传附件
InsertAttachment(context.Context, *NoteAttachmentItem) (*protobuf.StatusReply, error)
InsertAttachment(context.Context, *NoteAttachmentItem) (*StatusReply, error)
// 删除附件
DeleteAttachment(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error)
DeleteAttachment(context.Context, *IdentRequest) (*StatusReply, error)
}
// UnimplementedNoteServer should be embedded to have
@@ -203,34 +202,34 @@ type NoteServer interface {
// pointer dereference when methods are called.
type UnimplementedNoteServer struct{}
func (UnimplementedNoteServer) CreateNote(context.Context, *CreateNoteRequest) (*protobuf.StatusReply, error) {
func (UnimplementedNoteServer) CreateNote(context.Context, *CreateNoteRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method CreateNote not implemented")
}
func (UnimplementedNoteServer) GetNote(context.Context, *protobuf.IdentRequest) (*CloudNoteItem, error) {
func (UnimplementedNoteServer) GetNote(context.Context, *IdentRequest) (*CloudNoteItem, error) {
return nil, status.Error(codes.Unimplemented, "method GetNote not implemented")
}
func (UnimplementedNoteServer) UpdateNote(context.Context, *CloudNoteItem) (*protobuf.StatusReply, error) {
func (UnimplementedNoteServer) UpdateNote(context.Context, *CloudNoteItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method UpdateNote not implemented")
}
func (UnimplementedNoteServer) DeleteNote(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error) {
func (UnimplementedNoteServer) DeleteNote(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteNote not implemented")
}
func (UnimplementedNoteServer) ListNotes(context.Context, *protobuf.FetchRequest) (*ListNotesResponse, error) {
func (UnimplementedNoteServer) ListNotes(context.Context, *FetchRequest) (*ListNotesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListNotes not implemented")
}
func (UnimplementedNoteServer) TogglePin(context.Context, *TogglePinRequest) (*protobuf.StatusReply, error) {
func (UnimplementedNoteServer) TogglePin(context.Context, *TogglePinRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method TogglePin not implemented")
}
func (UnimplementedNoteServer) IncrementViews(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error) {
func (UnimplementedNoteServer) IncrementViews(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method IncrementViews not implemented")
}
func (UnimplementedNoteServer) SearchNotes(context.Context, *protobuf.FetchRequest) (*ListNotesResponse, error) {
func (UnimplementedNoteServer) SearchNotes(context.Context, *FetchRequest) (*ListNotesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SearchNotes not implemented")
}
func (UnimplementedNoteServer) InsertAttachment(context.Context, *NoteAttachmentItem) (*protobuf.StatusReply, error) {
func (UnimplementedNoteServer) InsertAttachment(context.Context, *NoteAttachmentItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method InsertAttachment not implemented")
}
func (UnimplementedNoteServer) DeleteAttachment(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error) {
func (UnimplementedNoteServer) DeleteAttachment(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteAttachment not implemented")
}
func (UnimplementedNoteServer) testEmbeddedByValue() {}
@@ -272,7 +271,7 @@ func _Note_CreateNote_Handler(srv interface{}, ctx context.Context, dec func(int
}
func _Note_GetNote_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,7 +283,7 @@ func _Note_GetNote_Handler(srv interface{}, ctx context.Context, dec func(interf
FullMethod: Note_GetNote_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NoteServer).GetNote(ctx, req.(*protobuf.IdentRequest))
return srv.(NoteServer).GetNote(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -308,7 +307,7 @@ func _Note_UpdateNote_Handler(srv interface{}, ctx context.Context, dec func(int
}
func _Note_DeleteNote_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
}
@@ -320,13 +319,13 @@ func _Note_DeleteNote_Handler(srv interface{}, ctx context.Context, dec func(int
FullMethod: Note_DeleteNote_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NoteServer).DeleteNote(ctx, req.(*protobuf.IdentRequest))
return srv.(NoteServer).DeleteNote(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Note_ListNotes_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
}
@@ -338,7 +337,7 @@ func _Note_ListNotes_Handler(srv interface{}, ctx context.Context, dec func(inte
FullMethod: Note_ListNotes_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NoteServer).ListNotes(ctx, req.(*protobuf.FetchRequest))
return srv.(NoteServer).ListNotes(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -362,7 +361,7 @@ func _Note_TogglePin_Handler(srv interface{}, ctx context.Context, dec func(inte
}
func _Note_IncrementViews_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
}
@@ -374,13 +373,13 @@ func _Note_IncrementViews_Handler(srv interface{}, ctx context.Context, dec func
FullMethod: Note_IncrementViews_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NoteServer).IncrementViews(ctx, req.(*protobuf.IdentRequest))
return srv.(NoteServer).IncrementViews(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Note_SearchNotes_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
}
@@ -392,7 +391,7 @@ func _Note_SearchNotes_Handler(srv interface{}, ctx context.Context, dec func(in
FullMethod: Note_SearchNotes_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NoteServer).SearchNotes(ctx, req.(*protobuf.FetchRequest))
return srv.(NoteServer).SearchNotes(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -416,7 +415,7 @@ func _Note_InsertAttachment_Handler(srv interface{}, ctx context.Context, dec fu
}
func _Note_DeleteAttachment_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
}
@@ -428,7 +427,7 @@ func _Note_DeleteAttachment_Handler(srv interface{}, ctx context.Context, dec fu
FullMethod: Note_DeleteAttachment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NoteServer).DeleteAttachment(ctx, req.(*protobuf.IdentRequest))
return srv.(NoteServer).DeleteAttachment(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}