🎇 指定路径与深度rebuild

This commit is contained in:
微凉
2021-04-14 13:34:14 +08:00
parent b613598c2b
commit 427244d8d5
9 changed files with 123 additions and 25 deletions

View File

@@ -18,6 +18,7 @@ type File struct {
Size int64 `json:"size"`
Password string `json:"password"`
Url string `json:"url" gorm:"-"`
ContentHash string `json:"content_hash"`
}
func (file *File) Create() error {
@@ -62,3 +63,7 @@ func SearchByNameInDir(keyword string, dir string) (*[]File, error) {
}
return &files, nil
}
func DeleteWithDir(dir string) error {
return conf.DB.Where("dir like ?", fmt.Sprintf("%s%%", dir)).Delete(&File{}).Error
}