alist/internal/model/object.go

68 lines
780 B
Go
Raw Normal View History

2022-06-15 10:06:42 +00:00
package model
2022-06-06 13:48:53 +00:00
2022-06-15 12:41:17 +00:00
import "time"
2022-06-06 13:48:53 +00:00
2022-06-15 12:41:17 +00:00
type Object struct {
ID string
Name string
2022-06-23 07:57:36 +00:00
Size int64
2022-06-15 12:41:17 +00:00
Modified time.Time
IsFolder bool
2022-06-06 13:48:53 +00:00
}
2022-09-02 10:24:14 +00:00
func (o *Object) GetName() string {
2022-08-11 12:32:17 +00:00
return o.Name
2022-06-06 13:48:53 +00:00
}
2022-06-07 14:02:41 +00:00
2022-09-02 10:24:14 +00:00
func (o *Object) GetSize() int64 {
2022-08-11 12:32:17 +00:00
return o.Size
2022-06-07 14:02:41 +00:00
}
2022-09-02 10:24:14 +00:00
func (o *Object) ModTime() time.Time {
2022-08-11 12:32:17 +00:00
return o.Modified
2022-06-15 12:41:17 +00:00
}
2022-09-02 10:24:14 +00:00
func (o *Object) IsDir() bool {
2022-08-11 12:32:17 +00:00
return o.IsFolder
2022-06-15 12:41:17 +00:00
}
2022-09-02 10:24:14 +00:00
func (o *Object) GetID() string {
2022-08-11 12:32:17 +00:00
return o.ID
2022-06-07 14:02:41 +00:00
}
2022-06-16 12:25:33 +00:00
2022-08-11 12:32:17 +00:00
func (o *Object) SetID(id string) {
o.ID = id
}
type Thumbnail struct {
Thumbnail string
}
2022-09-02 10:24:14 +00:00
type Url struct {
Url string
}
func (w Url) URL() string {
return w.Url
}
2022-08-11 12:32:17 +00:00
func (t Thumbnail) Thumb() string {
return t.Thumbnail
}
2022-09-02 10:24:14 +00:00
type ObjThumb struct {
Object
Thumbnail
}
type ObjectURL struct {
Object
Url
}
type ObjThumbURL struct {
2022-08-11 12:32:17 +00:00
Object
Thumbnail
2022-09-02 10:24:14 +00:00
Url
2022-06-16 12:25:33 +00:00
}