alist/internal/model/object.go
Sean a3748af772
feat: misc improvements about upload/copy/hash (#5045)
general: add createTime/updateTime support in webdav and some drivers
general: add hash support in some drivers
general: cross-storage rapid-upload support
general: enhance upload to avoid local temp file if possible
general: replace readseekcloser with File interface to speed upstream operations
feat(aliyun_open): same as above
feat(crypt): add hack for 139cloud

Close #4934 
Close #4819 

baidu_netdisk needs to improve the upload code to support rapid-upload
2023-08-27 21:14:23 +08:00

105 lines
1.3 KiB
Go

package model
import (
"time"
"github.com/alist-org/alist/v3/pkg/utils"
)
type ObjWrapName struct {
Name string
Obj
}
func (o *ObjWrapName) Unwrap() Obj {
return o.Obj
}
func (o *ObjWrapName) GetName() string {
if o.Name == "" {
o.Name = utils.MappingName(o.Obj.GetName())
}
return o.Name
}
type Object struct {
ID string
Path string
Name string
Size int64
Modified time.Time
Ctime time.Time // file create time
IsFolder bool
HashInfo utils.HashInfo
}
func (o *Object) GetName() string {
return o.Name
}
func (o *Object) GetSize() int64 {
return o.Size
}
func (o *Object) ModTime() time.Time {
return o.Modified
}
func (o *Object) CreateTime() time.Time {
if o.Ctime.IsZero() {
return o.ModTime()
}
return o.Ctime
}
func (o *Object) IsDir() bool {
return o.IsFolder
}
func (o *Object) GetID() string {
return o.ID
}
func (o *Object) GetPath() string {
return o.Path
}
func (o *Object) SetPath(path string) {
o.Path = path
}
func (o *Object) GetHash() utils.HashInfo {
return o.HashInfo
}
type Thumbnail struct {
Thumbnail string
}
type Url struct {
Url string
}
func (w Url) URL() string {
return w.Url
}
func (t Thumbnail) Thumb() string {
return t.Thumbnail
}
type ObjThumb struct {
Object
Thumbnail
}
type ObjectURL struct {
Object
Url
}
type ObjThumbURL struct {
Object
Thumbnail
Url
}