#GORM Defining foreign key directly from tag

3 messages · Page 1 of 1 (latest)

daring token
#

I have a situation where I'm trying to instead of using convention such as

UserID int
User User 

use

User User `gorm:"foreignKey:UserID"`

I was wondering if it will work and if GORM can deduce it or if UserID is mandatory.

uncut ore
daring token
#

Thank you