mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-19 20:26:26 +08:00

* Enable blank issue * chore(README.md): update docs (temporally) * Update FUNDING.yml * chore: purge README.md * chore: change module name to OpenListTeam/OpenList * fix: fix link errors * chore: remove v3 in module name * fix: resolve some conficts * fix: resolve conficts * docs: update with latest file --------- Co-authored-by: ShenLin <773933146@qq.com> Co-authored-by: Hantong Chen <cxwdyx620@gmail.com> Co-authored-by: joshua <i@joshua.su> Co-authored-by: Hantong Chen <70561268+cxw620@users.noreply.github.com>
102 lines
1.3 KiB
Go
102 lines
1.3 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/OpenListTeam/OpenList/pkg/utils"
|
|
)
|
|
|
|
type ObjWrapName struct {
|
|
Name string
|
|
Obj
|
|
}
|
|
|
|
func (o *ObjWrapName) Unwrap() Obj {
|
|
return o.Obj
|
|
}
|
|
|
|
func (o *ObjWrapName) GetName() string {
|
|
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
|
|
}
|