Files
ocean/file/file/file_grpc.pb.go
2025-05-31 21:44:34 +08:00

208 lines
7.2 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.19.4
// source: rpc/file.proto
package file
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
File_Upload_FullMethodName = "/file.File/Upload"
File_GetFileUrl_FullMethodName = "/file.File/GetFileUrl"
File_Delete_FullMethodName = "/file.File/Delete"
)
// FileClient is the client API for File service.
//
// 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 FileClient interface {
// 上传文件(图片/头像/壁纸等)
Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*UploadResponse, error)
// 获取文件访问链接(带签名,防盗链)
GetFileUrl(ctx context.Context, in *GetFileUrlRequest, opts ...grpc.CallOption) (*GetFileUrlResponse, error)
// 删除文件
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
}
type fileClient struct {
cc grpc.ClientConnInterface
}
func NewFileClient(cc grpc.ClientConnInterface) FileClient {
return &fileClient{cc}
}
func (c *fileClient) Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*UploadResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UploadResponse)
err := c.cc.Invoke(ctx, File_Upload_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileClient) GetFileUrl(ctx context.Context, in *GetFileUrlRequest, opts ...grpc.CallOption) (*GetFileUrlResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetFileUrlResponse)
err := c.cc.Invoke(ctx, File_GetFileUrl_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *fileClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeleteResponse)
err := c.cc.Invoke(ctx, File_Delete_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// FileServer is the server API for File service.
// All implementations must embed UnimplementedFileServer
// for forward compatibility.
//
// 文件服务 - 上传图片、获取地址、删除文件等
type FileServer interface {
// 上传文件(图片/头像/壁纸等)
Upload(context.Context, *UploadRequest) (*UploadResponse, error)
// 获取文件访问链接(带签名,防盗链)
GetFileUrl(context.Context, *GetFileUrlRequest) (*GetFileUrlResponse, error)
// 删除文件
Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
mustEmbedUnimplementedFileServer()
}
// UnimplementedFileServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedFileServer struct{}
func (UnimplementedFileServer) Upload(context.Context, *UploadRequest) (*UploadResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Upload not implemented")
}
func (UnimplementedFileServer) GetFileUrl(context.Context, *GetFileUrlRequest) (*GetFileUrlResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetFileUrl not implemented")
}
func (UnimplementedFileServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedFileServer) mustEmbedUnimplementedFileServer() {}
func (UnimplementedFileServer) testEmbeddedByValue() {}
// UnsafeFileServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FileServer will
// result in compilation errors.
type UnsafeFileServer interface {
mustEmbedUnimplementedFileServer()
}
func RegisterFileServer(s grpc.ServiceRegistrar, srv FileServer) {
// If the following call pancis, it indicates UnimplementedFileServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&File_ServiceDesc, srv)
}
func _File_Upload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UploadRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServer).Upload(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: File_Upload_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServer).Upload(ctx, req.(*UploadRequest))
}
return interceptor(ctx, in, info, handler)
}
func _File_GetFileUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetFileUrlRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServer).GetFileUrl(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: File_GetFileUrl_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServer).GetFileUrl(ctx, req.(*GetFileUrlRequest))
}
return interceptor(ctx, in, info, handler)
}
func _File_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FileServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: File_Delete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FileServer).Delete(ctx, req.(*DeleteRequest))
}
return interceptor(ctx, in, info, handler)
}
// File_ServiceDesc is the grpc.ServiceDesc for File service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var File_ServiceDesc = grpc.ServiceDesc{
ServiceName: "file.File",
HandlerType: (*FileServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Upload",
Handler: _File_Upload_Handler,
},
{
MethodName: "GetFileUrl",
Handler: _File_GetFileUrl_Handler,
},
{
MethodName: "Delete",
Handler: _File_Delete_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "rpc/file.proto",
}