Feat: rename file

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

No files matched your search

+5
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
}