Feat: rename file

This commit is contained in:
HFO4
2019-12-07 15:54:07 +08:00
parent f4c414c0f6
commit 10a2ef4267
7 changed files with 83 additions and 4 deletions

View File

@@ -141,3 +141,8 @@ func GetFilesByParentIDs(ids []uint, uid uint) ([]File, error) {
result := DB.Where("user_id = ? and folder_id in (?)", uid, ids).Find(&files)
return files, result.Error
}
// Rename 重命名文件
func (file *File) Rename(new string) error {
return DB.Model(&file).Update("name", new).Error
}