使用最新的protoc-gen-go和protoc-gen-go-grpc插件

This commit is contained in:
刘祥超
2023-08-06 23:36:50 +08:00
parent 65be70d015
commit e6af6b6575
315 changed files with 55373 additions and 51574 deletions

View File

@@ -1,17 +1,12 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc-gen-go v1.31.0
// protoc v3.19.4
// source: service_file.proto
package pb
import (
context "context"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -25,10 +20,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
// 查找文件
type FindEnabledFileRequest struct {
state protoimpl.MessageState
@@ -471,161 +462,3 @@ func file_service_file_proto_init() {
file_service_file_proto_goTypes = nil
file_service_file_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// FileServiceClient is the client API for FileService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type FileServiceClient interface {
// 查找文件
FindEnabledFile(ctx context.Context, in *FindEnabledFileRequest, opts ...grpc.CallOption) (*FindEnabledFileResponse, error)
// 创建文件
CreateFile(ctx context.Context, in *CreateFileRequest, opts ...grpc.CallOption) (*CreateFileResponse, error)
// 将文件置为已完成
UpdateFileFinished(ctx context.Context, in *UpdateFileFinishedRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
}
type fileServiceClient struct {
cc grpc.ClientConnInterface
}
func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient {
return &fileServiceClient{cc}
}
func (c *fileServiceClient) FindEnabledFile(ctx context.Context, in *FindEnabledFileRequest, opts ...grpc.CallOption) (*FindEnabledFileResponse, error) {
out := new(FindEnabledFileResponse)
err := c.cc.Invoke(ctx, "/pb.FileService/findEnabledFile", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) CreateFile(ctx context.Context, in *CreateFileRequest, opts ...grpc.CallOption) (*CreateFileResponse, error) {
out := new(CreateFileResponse)
err := c.cc.Invoke(ctx, "/pb.FileService/createFile", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileServiceClient) UpdateFileFinished(ctx context.Context, in *UpdateFileFinishedRequest, opts ...grpc.CallOption) (*RPCSuccess, error) {
out := new(RPCSuccess)
err := c.cc.Invoke(ctx, "/pb.FileService/updateFileFinished", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// FileServiceServer is the server API for FileService service.
type FileServiceServer interface {
// 查找文件
FindEnabledFile(context.Context, *FindEnabledFileRequest) (*FindEnabledFileResponse, error)
// 创建文件
CreateFile(context.Context, *CreateFileRequest) (*CreateFileResponse, error)
// 将文件置为已完成
UpdateFileFinished(context.Context, *UpdateFileFinishedRequest) (*RPCSuccess, error)
}
// UnimplementedFileServiceServer can be embedded to have forward compatible implementations.
type UnimplementedFileServiceServer struct {
}
func (*UnimplementedFileServiceServer) FindEnabledFile(context.Context, *FindEnabledFileRequest) (*FindEnabledFileResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledFile not implemented")
}
func (*UnimplementedFileServiceServer) CreateFile(context.Context, *CreateFileRequest) (*CreateFileResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateFile not implemented")
}
func (*UnimplementedFileServiceServer) UpdateFileFinished(context.Context, *UpdateFileFinishedRequest) (*RPCSuccess, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateFileFinished not implemented")
}
func RegisterFileServiceServer(s *grpc.Server, srv FileServiceServer) {
s.RegisterService(&_FileService_serviceDesc, srv)
}
func _FileService_FindEnabledFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FindEnabledFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).FindEnabledFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.FileService/FindEnabledFile",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).FindEnabledFile(ctx, req.(*FindEnabledFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_CreateFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateFileRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).CreateFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.FileService/CreateFile",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).CreateFile(ctx, req.(*CreateFileRequest))
}
return interceptor(ctx, in, info, handler)
}
func _FileService_UpdateFileFinished_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateFileFinishedRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServiceServer).UpdateFileFinished(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.FileService/UpdateFileFinished",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServiceServer).UpdateFileFinished(ctx, req.(*UpdateFileFinishedRequest))
}
return interceptor(ctx, in, info, handler)
}
var _FileService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.FileService",
HandlerType: (*FileServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "findEnabledFile",
Handler: _FileService_FindEnabledFile_Handler,
},
{
MethodName: "createFile",
Handler: _FileService_CreateFile_Handler,
},
{
MethodName: "updateFileFinished",
Handler: _FileService_UpdateFileFinished_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_file.proto",
}