type user struct {
ID int
Username string `gorm:"size:255"`
Name string `gorm:"size:255"`
}
I want to create a table 'user' using this model. But the table name automatically set to 'users'. I know it is gorm's default behaviour. But I want the table name to be 'user'.
Set method TableName
for your struct.
func (user) TableName() string {
return "user"
}