标签:create mod dup get people this jin void highlight
The GORM is an super easy ORM solution for Go language.
But many people would get the error about
duplicate column name: id
Usually this comes from the model definition which has duplicated ID,
package model import ( "github.com/jinzhu/gorm" ) type Job struct { gorm.Model // Already has ID, CreatedAt, UpdatedAt, DeletedAt 4 fields Name string }
We could remove the ID definition from our code and only use the one from grom.Model, or don‘t use the gorm.Model at all.
Tips on GORM, Avoid Error about "duplicate column name: id"
标签:create mod dup get people this jin void highlight
原文地址:https://www.cnblogs.com/Jedimaster/p/8849013.html