I have those two models:
User model:
type User struct {
DBBase
Email string `gorm:"column:email" json:"email"`
Password string `gorm:"column:password" json:"-"`
}
func (User) TableName() string {
return "t_user"
}
User info model:
type UserInfo struct {
UID uint `gorm:"column:u_id" json:"-"`
FirstName string `gorm:"column:first_name" json:"first_name"`
LastName string `gorm:"column:last_name" json:"last_name"`
Phone string `gorm:"column:phone" json:"phone"`
Address string `gorm:"column:address" json:"address"`
}
func (UserInfo) TableName() string {
return "t_user_info"
}
and I want to make UID related to the id of the user table.
I did try what gorm wrote on the documentation, but without success: http://doc.gorm.io/associations.html