Your Question
I have a 2 tables: user and order, order belong an user.
User {
ID uint
Name string
...
}
Order {
ID uint
UserID uint
User User
}
How can I get order with only user's name? I use following code to do this but it get all fields of user
DB.
Model(&Order{}).
Preload("User").
First(&order, "id = ?", orderId).Error
The document you expected this should be explained
I can't find any doc to solve this problem.
Expected answer
a command to get order with some specific fields of preloads.
Comment From: bayaderpack
can someone give example if this is possible I want do the same?