star
This commit is contained in:
		@@ -30,6 +30,7 @@ type Model struct {
 | 
			
		||||
	UserID       int       `json:"user_id"`                  // 模型的所有者
 | 
			
		||||
	DatasetID    int       `json:"dataset_id"`               // 模型所使用的數據集ID
 | 
			
		||||
	ServerID     string    `json:"server_id"`                // 模型所在服務器(訓練機或推理機)
 | 
			
		||||
	Stars        StarList  `json:"stars"`                    // 模型的收藏者
 | 
			
		||||
	CreatedAt    time.Time `json:"created_at" gorm:"autoCreateTime"`
 | 
			
		||||
	UpdatedAt    time.Time `json:"updated_at" gorm:"autoUpdateTime"`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,3 +27,13 @@ func (list *TagList) Scan(value interface{}) error {
 | 
			
		||||
func (list TagList) Value() (driver.Value, error) {
 | 
			
		||||
	return json.Marshal(list)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type StarList []int
 | 
			
		||||
 | 
			
		||||
func (list *StarList) Scan(value interface{}) error {
 | 
			
		||||
	return json.Unmarshal(value.([]byte), list)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (list StarList) Value() (driver.Value, error) {
 | 
			
		||||
	return json.Marshal(list)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user