fsctx

package
v1.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GinCtx Gin的上下文
	GinCtx key = iota
	// PathCtx 文件或目录的虚拟路径
	PathCtx
	// FileModelCtx 文件数据库模型
	FileModelCtx
	// FolderModelCtx 目录数据库模型
	FolderModelCtx
	// HTTPCtx HTTP请求的上下文
	HTTPCtx
	// UploadPolicyCtx 上传策略,一般为slave模式下使用
	UploadPolicyCtx
	// UserCtx 用户
	UserCtx
	// ThumbSizeCtx 缩略图尺寸
	ThumbSizeCtx
	// FileSizeCtx 文件大小
	FileSizeCtx
	// ShareKeyCtx 分享文件的 HashID
	ShareKeyCtx
	// LimitParentCtx 限制父目录
	LimitParentCtx
	// IgnoreDirectoryConflictCtx 忽略目录重名冲突
	IgnoreDirectoryConflictCtx
	// RetryCtx 失败重试次数
	RetryCtx
	// ForceUsePublicEndpointCtx 强制使用公网 Endpoint
	ForceUsePublicEndpointCtx
	// CancelFuncCtx Context 取消函數
	CancelFuncCtx
	// 文件在从机节点中的路径
	SlaveSrcPath
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileHeader

type FileHeader interface {
	io.Reader
	io.Closer
	io.Seeker
	Info() *UploadTaskInfo
	SetSize(uint64)
	SetModel(fileModel interface{})
	Seekable() bool
	RetFileStream() *FileStream
}

FileHeader 上传来的文件数据处理器

type FileStream

type FileStream struct {
	Mode            WriteMode
	LastModified    *time.Time
	Metadata        map[string]string
	File            io.ReadCloser
	Seeker          io.Seeker
	Size            uint64
	VirtualPath     string
	Name            string
	MIMEType        string
	SavePath        string
	UploadSessionID *string
	AppendStart     uint64
	Model           interface{}
	Src             string
	EncodePath      string
	Md5             string
	Fileid          int64
	FolderId        int64
}

FileStream 用户传来的文件

func (*FileStream) Close

func (file *FileStream) Close() error

func (*FileStream) Info

func (file *FileStream) Info() *UploadTaskInfo

func (*FileStream) Read

func (file *FileStream) Read(p []byte) (n int, err error)

func (*FileStream) RetFileStream added in v1.4.21

func (file *FileStream) RetFileStream() *FileStream

func (*FileStream) Seek

func (file *FileStream) Seek(offset int64, whence int) (int64, error)

func (*FileStream) Seekable

func (file *FileStream) Seekable() bool

func (*FileStream) SetModel

func (file *FileStream) SetModel(fileModel interface{})

func (*FileStream) SetSize

func (file *FileStream) SetSize(size uint64)

type UploadTaskInfo

type UploadTaskInfo struct {
	Size            uint64
	MIMEType        string
	FileName        string
	VirtualPath     string
	Mode            WriteMode
	Metadata        map[string]string
	LastModified    *time.Time
	SavePath        string
	UploadSessionID *string
	AppendStart     uint64
	Model           interface{}
	Src             string
	EncodePath      string
	Md5             string
	Fileid          uint
	FolderId        uint
}

type WriteMode

type WriteMode int
const (
	Overwrite WriteMode = 0x00001
	// Append 只适用于本地策略
	Append WriteMode = 0x00002
	Nop    WriteMode = 0x00004
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL