
// 重设列名 type Animal struct { AnimalId int64 `gorm:"column:beast_id"` // 设置列名为`beast_id` Birthday time.Time `gorm:"column:day_of_the_beast"` // 设置列名为`day_of_the_beast` Age int64 `gorm:"column:age_of_the_beast"` // 设置列名为`age_of_the_beast` } // 使用 tag`primary_key`用来设置主键 type Animal struct { AnimalId int64 `gorm:"primary_key"` // 设置 AnimalId 为主键 Name string Age int64 } 如果需要给一个字段 重设列名 & 设置主键 该咋写?