mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: insert file record to database
This commit is contained in:
@@ -16,6 +16,14 @@ type File struct {
|
||||
Dir string `gorm:"size:65536"`
|
||||
}
|
||||
|
||||
// Create 创建文件记录
|
||||
func (file *File) Create() (uint, error) {
|
||||
if err := DB.Create(file).Error; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return file.ID, nil
|
||||
}
|
||||
|
||||
// GetFileByPathAndName 给定路径、文件名、用户ID,查找文件
|
||||
func GetFileByPathAndName(path string, name string, uid uint) (File, error) {
|
||||
var file File
|
||||
|
||||
Reference in New Issue
Block a user