All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 30s
49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// goctl 1.8.3
|
|
// Source: file.proto
|
|
|
|
package server
|
|
|
|
import (
|
|
"context"
|
|
|
|
"godemo/file/file"
|
|
"godemo/file/internal/logic"
|
|
"godemo/file/internal/svc"
|
|
)
|
|
|
|
type FileServer struct {
|
|
svcCtx *svc.ServiceContext
|
|
file.UnimplementedFileServer
|
|
}
|
|
|
|
func NewFileServer(svcCtx *svc.ServiceContext) *FileServer {
|
|
return &FileServer{
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
// 上传文件(图片/头像/壁纸等)
|
|
func (s *FileServer) Upload(ctx context.Context, in *file.UploadRequest) (*file.UploadResponse, error) {
|
|
l := logic.NewUploadLogic(ctx, s.svcCtx)
|
|
return l.Upload(in)
|
|
}
|
|
|
|
// 获取文件访问链接(带签名,防盗链)
|
|
func (s *FileServer) GetFileUrl(ctx context.Context, in *file.GetFileUrlRequest) (*file.GetFileUrlResponse, error) {
|
|
l := logic.NewGetFileUrlLogic(ctx, s.svcCtx)
|
|
return l.GetFileUrl(in)
|
|
}
|
|
|
|
// 删除文件
|
|
func (s *FileServer) Delete(ctx context.Context, in *file.DeleteRequest) (*file.DeleteResponse, error) {
|
|
l := logic.NewDeleteLogic(ctx, s.svcCtx)
|
|
return l.Delete(in)
|
|
}
|
|
|
|
// 异步生成图片版本接口
|
|
func (s *FileServer) GenerateImageVersions(ctx context.Context, in *file.GenerateImageVersionsRequest) (*file.GenerateImageVersionsResponse, error) {
|
|
l := logic.NewGenerateImageVersionsLogic(ctx, s.svcCtx)
|
|
return l.GenerateImageVersions(in)
|
|
}
|