Fix: test failed due to Policy.AutoName

This commit is contained in:
HFO4
2019-11-19 17:20:59 +08:00
parent 88a543ef74
commit 20ea86eaf6
5 changed files with 49 additions and 1 deletions

View File

@@ -15,3 +15,10 @@ type File struct {
PolicyID uint
Dir string `gorm:"size:65536"`
}
// GetFileByPathAndName 给定路径、文件名、用户ID查找文件
func GetFileByPathAndName(path string, name string, uid uint) (File, error) {
var file File
result := DB.Where("user_id = ? AND dir = ? AND name=?", uid, path, name).Find(&file)
return file, result.Error
}