package models type User struct { ID uint `gorm:"primary_key" json:"id"` UserID int64 `json:"user_id"` Groups []*Group `json:"groups" gorm:"many2many:GroupUser;"` } func (User) TableName() string { return "Users" }