Skip to content

[Question] Fetch certain fields only #285

@hsquared66

Description

@hsquared66

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions