Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Fetch certain fields only #285

Open
hsquared66 opened this issue Feb 8, 2021 · 0 comments
Open

[Question] Fetch certain fields only #285

hsquared66 opened this issue Feb 8, 2021 · 0 comments

Comments

@hsquared66
Copy link

hsquared66 commented Feb 8, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant