storm icon indicating copy to clipboard operation
storm copied to clipboard

[Question] Fetch certain fields only

Open hsquared66 opened this issue 5 years ago • 0 comments

Hey there I wonder if storm can support fetch certain fields only like gorm do:

type User struct {
  ID     uint
  Name   string
  Age    int
  Gender string  // hundreds of fields
}

type APIUser struct {
  ID   uint
  Name string
}

// Select `id`, `name` automatically when querying
db.Model(&User{}).Limit(10).Find(&APIUser{})
// SELECT `id`, `name` FROM `users` LIMIT 10

I've seen you had answered at #216 that this will be able to do with the v3, but I've not found any documents or samples about that. Could you please help on this? Thanks a lot!

hsquared66 avatar Feb 08 '21 04:02 hsquared66