package models import ( "gorm.io/datatypes" ) // PracticeProgress 练习进度记录(每道题目一条记录) type PracticeProgress struct { ID int64 `gorm:"primarykey" json:"id"` CurrentQuestionID int64 `gorm:"not null" json:"current_question_id"` UserID int64 `gorm:"not null;uniqueIndex:idx_user_question" json:"user_id"` Type string `gorm:"type:varchar(255);not null" json:"type"` UserAnswerRecords datatypes.JSON `gorm:"type:jsonp" json:"answers"` } // TableName 指定表名 func (PracticeProgress) TableName() string { return "practice_progress" }