37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
package entity
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type DeletedFile struct {
|
|
ID uint `json:"id" gorm:"primaryKey;comment:删除记录ID"`
|
|
UserID uint `json:"user_id" gorm:"comment:用户ID"`
|
|
UserCode string `json:"user_code" gorm:"index;size:8;comment:用户码"`
|
|
FileKey string `json:"file_key" gorm:"size:500;comment:文件存储键"`
|
|
FileName string `json:"file_name" gorm:"size:255;comment:文件名"`
|
|
Size int64 `json:"size" gorm:"comment:文件大小(字节)"`
|
|
DeletedAt time.Time `json:"deleted_at" gorm:"comment:删除时间"`
|
|
RemovedAt gorm.DeletedAt `json:"-" gorm:"comment:物理删除时间"`
|
|
}
|
|
|
|
func (DeletedFile) TableName() string {
|
|
return "deleted_files"
|
|
}
|
|
|
|
func (DeletedFile) TableComment() string {
|
|
return "回收站文件表"
|
|
}
|
|
|
|
func NewDeletedFile(userID uint, userCode, fileKey, fileName string, size int64) *DeletedFile {
|
|
return &DeletedFile{
|
|
UserID: userID,
|
|
UserCode: userCode,
|
|
FileKey: fileKey,
|
|
FileName: fileName,
|
|
Size: size,
|
|
}
|
|
}
|