Documentation
¶
Index ¶
- Constants
- func Domain(r *http.Request, domain string) (string, error)
- func FileMimeType(path string) (string, error)
- func List[T any](page int32, pageSize int32, list []T) (total, totalPage int64, res []T)
- func Save(file *multipart.FileHeader, path string, compress bool) (size int64, err error)
- type Config
- type File
- type FileConfig
- type Files
- func (f *Files) Base64ToFile(b64 string, dir string, l Limit) (*File, error)
- func (f *Files) Delete(path string, name string) error
- func (f *Files) GetPath(dir string, types string) (string, error)
- func (f *Files) List(param ListParam) (*ListRes, error)
- func (f *Files) Upload(file *multipart.FileHeader, dir string, l Limit) (*File, error)
- type Limit
- type ListParam
- type ListRes
- type Upload
Constants ¶
View Source
const UPLOAD_DIR = "upload"
Variables ¶
This section is empty.
Functions ¶
func FileMimeType ¶
Types ¶
type File ¶
type File struct {
Name string `json:"name"` // 文件名,不包含扩展名
Extension string `json:"extension"` // 扩展名
FullName string `json:"full_name"` // 文件名,包含扩展名
Path string `json:"path"` // 文件保存路径
Url string `json:"url"` // 文件访问路径
Size int64 `json:"size"` // 文件大小
FileType string `json:"file_type"` // 文件类型:image、video、other、dir
Type string `json:"type"` // 文件类型:image、video、other、dir 兼容旧版本
IsDir bool `json:"is_dir"` // 是否是文件夹
ModTime string `json:"mod_time"` // 修改时间
Mime string `json:"mime"` // 文件mime
}
type FileConfig ¶
type Files ¶
type Files struct {
Request *http.Request
Config *FileConfig
}
func (*Files) Base64ToFile ¶
Click to show internal directories.
Click to hide internal directories.