138 lines
6.2 KiB
Go
138 lines
6.2 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.10.1
|
|
// Source: file.proto
|
|
|
|
package fileservice
|
|
|
|
import (
|
|
"context"
|
|
|
|
"sundynix-micro-go/app/file/rpc/file"
|
|
|
|
"github.com/zeromicro/go-zero/zrpc"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type (
|
|
CheckFileByMd5Req = file.CheckFileByMd5Req
|
|
CheckFileByMd5Resp = file.CheckFileByMd5Resp
|
|
CommonResp = file.CommonResp
|
|
CreateFileReq = file.CreateFileReq
|
|
CreateFileResp = file.CreateFileResp
|
|
CreateStorageConfigReq = file.CreateStorageConfigReq
|
|
DeleteFilesReq = file.DeleteFilesReq
|
|
FileInfo = file.FileInfo
|
|
GetDefaultStorageConfigReq = file.GetDefaultStorageConfigReq
|
|
GetDefaultStorageConfigResp = file.GetDefaultStorageConfigResp
|
|
GetFileByIdReq = file.GetFileByIdReq
|
|
GetFileByIdResp = file.GetFileByIdResp
|
|
GetFileListReq = file.GetFileListReq
|
|
GetFileListResp = file.GetFileListResp
|
|
GetFilesByIdsReq = file.GetFilesByIdsReq
|
|
GetFilesByIdsResp = file.GetFilesByIdsResp
|
|
SetDefaultStorageConfigReq = file.SetDefaultStorageConfigReq
|
|
StorageConfigInfo = file.StorageConfigInfo
|
|
StorageConfigListReq = file.StorageConfigListReq
|
|
StorageConfigListResp = file.StorageConfigListResp
|
|
UpdateStorageConfigReq = file.UpdateStorageConfigReq
|
|
|
|
FileService interface {
|
|
// 根据ID获取文件信息
|
|
GetFileById(ctx context.Context, in *GetFileByIdReq, opts ...grpc.CallOption) (*GetFileByIdResp, error)
|
|
// 根据ID列表批量获取文件信息
|
|
GetFilesByIds(ctx context.Context, in *GetFilesByIdsReq, opts ...grpc.CallOption) (*GetFilesByIdsResp, error)
|
|
// 创建文件记录
|
|
CreateFile(ctx context.Context, in *CreateFileReq, opts ...grpc.CallOption) (*CreateFileResp, error)
|
|
// 通过MD5检查文件是否存在
|
|
CheckFileByMd5(ctx context.Context, in *CheckFileByMd5Req, opts ...grpc.CallOption) (*CheckFileByMd5Resp, error)
|
|
// 删除文件记录
|
|
DeleteFiles(ctx context.Context, in *DeleteFilesReq, opts ...grpc.CallOption) (*CommonResp, error)
|
|
// 获取文件列表
|
|
GetFileList(ctx context.Context, in *GetFileListReq, opts ...grpc.CallOption) (*GetFileListResp, error)
|
|
// ---------- 存储配置 ----------
|
|
CreateStorageConfig(ctx context.Context, in *CreateStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error)
|
|
UpdateStorageConfig(ctx context.Context, in *UpdateStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error)
|
|
DeleteStorageConfig(ctx context.Context, in *DeleteFilesReq, opts ...grpc.CallOption) (*CommonResp, error)
|
|
SetDefaultStorageConfig(ctx context.Context, in *SetDefaultStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error)
|
|
GetStorageConfigList(ctx context.Context, in *StorageConfigListReq, opts ...grpc.CallOption) (*StorageConfigListResp, error)
|
|
GetDefaultStorageConfig(ctx context.Context, in *GetDefaultStorageConfigReq, opts ...grpc.CallOption) (*GetDefaultStorageConfigResp, error)
|
|
}
|
|
|
|
defaultFileService struct {
|
|
cli zrpc.Client
|
|
}
|
|
)
|
|
|
|
func NewFileService(cli zrpc.Client) FileService {
|
|
return &defaultFileService{
|
|
cli: cli,
|
|
}
|
|
}
|
|
|
|
// 根据ID获取文件信息
|
|
func (m *defaultFileService) GetFileById(ctx context.Context, in *GetFileByIdReq, opts ...grpc.CallOption) (*GetFileByIdResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.GetFileById(ctx, in, opts...)
|
|
}
|
|
|
|
// 根据ID列表批量获取文件信息
|
|
func (m *defaultFileService) GetFilesByIds(ctx context.Context, in *GetFilesByIdsReq, opts ...grpc.CallOption) (*GetFilesByIdsResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.GetFilesByIds(ctx, in, opts...)
|
|
}
|
|
|
|
// 创建文件记录
|
|
func (m *defaultFileService) CreateFile(ctx context.Context, in *CreateFileReq, opts ...grpc.CallOption) (*CreateFileResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.CreateFile(ctx, in, opts...)
|
|
}
|
|
|
|
// 通过MD5检查文件是否存在
|
|
func (m *defaultFileService) CheckFileByMd5(ctx context.Context, in *CheckFileByMd5Req, opts ...grpc.CallOption) (*CheckFileByMd5Resp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.CheckFileByMd5(ctx, in, opts...)
|
|
}
|
|
|
|
// 删除文件记录
|
|
func (m *defaultFileService) DeleteFiles(ctx context.Context, in *DeleteFilesReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.DeleteFiles(ctx, in, opts...)
|
|
}
|
|
|
|
// 获取文件列表
|
|
func (m *defaultFileService) GetFileList(ctx context.Context, in *GetFileListReq, opts ...grpc.CallOption) (*GetFileListResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.GetFileList(ctx, in, opts...)
|
|
}
|
|
|
|
// ---------- 存储配置 ----------
|
|
func (m *defaultFileService) CreateStorageConfig(ctx context.Context, in *CreateStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.CreateStorageConfig(ctx, in, opts...)
|
|
}
|
|
|
|
func (m *defaultFileService) UpdateStorageConfig(ctx context.Context, in *UpdateStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.UpdateStorageConfig(ctx, in, opts...)
|
|
}
|
|
|
|
func (m *defaultFileService) DeleteStorageConfig(ctx context.Context, in *DeleteFilesReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.DeleteStorageConfig(ctx, in, opts...)
|
|
}
|
|
|
|
func (m *defaultFileService) SetDefaultStorageConfig(ctx context.Context, in *SetDefaultStorageConfigReq, opts ...grpc.CallOption) (*CommonResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.SetDefaultStorageConfig(ctx, in, opts...)
|
|
}
|
|
|
|
func (m *defaultFileService) GetStorageConfigList(ctx context.Context, in *StorageConfigListReq, opts ...grpc.CallOption) (*StorageConfigListResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.GetStorageConfigList(ctx, in, opts...)
|
|
}
|
|
|
|
func (m *defaultFileService) GetDefaultStorageConfig(ctx context.Context, in *GetDefaultStorageConfigReq, opts ...grpc.CallOption) (*GetDefaultStorageConfigResp, error) {
|
|
client := file.NewFileServiceClient(m.cli.Conn())
|
|
return client.GetDefaultStorageConfig(ctx, in, opts...)
|
|
}
|