package model import "time" // 文件状态。 const ( FileStatusDisabled int8 = 0 FileStatusEnabled int8 = 1 ) // File 上传文件元数据。Path 相对存储根目录,Hash 唯一用于秒传去重。 type File struct { ID uint `gorm:"primaryKey" json:"id"` Name string `gorm:"size:255;not null" json:"name"` Path string `gorm:"size:512;not null" json:"path"` Extension string `gorm:"size:20" json:"extension"` MimeType string `gorm:"size:100" json:"mime_type"` Size int64 `gorm:"not null;default:0" json:"size"` Hash string `gorm:"size:64;uniqueIndex;not null" json:"hash"` RefCount int64 `gorm:"not null;default:0" json:"ref_count"` UploaderID *uint `gorm:"index" json:"uploader_id"` Storage string `gorm:"size:20;not null;default:'local'" json:"storage"` Status int8 `gorm:"not null;default:1" json:"status"` Metadata string `gorm:"type:text" json:"metadata"` LastReferencedAt *time.Time `json:"last_referenced_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }