So basically my problem is: Making request to database and I know that good practice is to make less request to database.
Here is some code, I’m using GORM library. I’m receiving an array with name’s and I need to get data about them. Straigforward solution is to make for each loop and call this query.
return r.DB.
Model(&models.User{}).Where("name = ?", name).Find(&user).Error
But this solution is bad practice, so I wonder is there any good solution to this problem?