chore(virtual): implement the driver interface with result

This commit is contained in:
Andy Hsu
2023-09-20 09:02:56 +08:00
parent 57eea4db17
commit f0981a0c8d
2 changed files with 51 additions and 22 deletions

22
drivers/virtual/util.go Normal file
View File

@ -0,0 +1,22 @@
package virtual
import (
"time"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/pkg/utils/random"
)
func (d *Virtual) genObj(dir bool) model.Obj {
obj := &model.Object{
Name: random.String(10),
Size: 0,
IsFolder: true,
Modified: time.Now(),
}
if !dir {
obj.Size = random.RangeInt64(d.MinFileSize, d.MaxFileSize)
obj.IsFolder = false
}
return obj
}