consistent ordering of structs in Belongs To docs

This commit is contained in:
Apurva Chitnis 2019-02-21 11:19:00 +00:00 committed by GitHub
parent f1caf058c5
commit 46d24b77a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,17 +6,17 @@
```go
// `User` belongs to `Profile`, `ProfileID` is the foreign key
type Profile struct {
gorm.Model
Name string
}
type User struct {
gorm.Model
Profile Profile
ProfileID int
}
type Profile struct {
gorm.Model
Name string
}
db.Model(&user).Related(&profile)
//// SELECT * FROM profiles WHERE id = 111; // 111 is user's foreign key ProfileID
```