asdine / storm

Simple and powerful toolkit for BoltDB
MIT License
2.06k stars 138 forks source link

[Question] Fetch certain fields only #285

Open hsquared66 opened 3 years ago

hsquared66 commented 3 years ago

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!