mirror of
				https://github.com/cloudreve/cloudreve.git
				synced 2025-11-01 00:57:15 +08:00 
			
		
		
		
	 79b8784934
			
		
	
	79b8784934
	
	
	
		
			
			* Code: compatible with semantic import versioning * Tools & Docs: compatible with semantic import versioning * Clean go.mod & go.sum
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package template
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"errors"
 | |
| 	"io"
 | |
| 	"net/url"
 | |
| 
 | |
| 	model "github.com/cloudreve/Cloudreve/v3/models"
 | |
| 	"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/response"
 | |
| 	"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
 | |
| )
 | |
| 
 | |
| // Driver 适配器模板
 | |
| type Driver struct {
 | |
| 	Policy *model.Policy
 | |
| }
 | |
| 
 | |
| // Get 获取文件
 | |
| func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser, error) {
 | |
| 	return nil, errors.New("未实现")
 | |
| }
 | |
| 
 | |
| // Put 将文件流保存到指定目录
 | |
| func (handler Driver) Put(ctx context.Context, file io.ReadCloser, dst string, size uint64) error {
 | |
| 	return errors.New("未实现")
 | |
| }
 | |
| 
 | |
| // Delete 删除一个或多个文件,
 | |
| // 返回未删除的文件,及遇到的最后一个错误
 | |
| func (handler Driver) Delete(ctx context.Context, files []string) ([]string, error) {
 | |
| 	return []string{}, errors.New("未实现")
 | |
| }
 | |
| 
 | |
| // Thumb 获取文件缩略图
 | |
| func (handler Driver) Thumb(ctx context.Context, path string) (*response.ContentResponse, error) {
 | |
| 	return nil, errors.New("未实现")
 | |
| }
 | |
| 
 | |
| // Source 获取外链URL
 | |
| func (handler Driver) Source(
 | |
| 	ctx context.Context,
 | |
| 	path string,
 | |
| 	baseURL url.URL,
 | |
| 	ttl int64,
 | |
| 	isDownload bool,
 | |
| 	speed int,
 | |
| ) (string, error) {
 | |
| 	return "", errors.New("未实现")
 | |
| }
 | |
| 
 | |
| // Token 获取上传策略和认证Token
 | |
| func (handler Driver) Token(ctx context.Context, TTL int64, key string) (serializer.UploadCredential, error) {
 | |
| 	return serializer.UploadCredential{}, errors.New("未实现")
 | |
| }
 |