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

Fields list in selects #17

Closed
grechkin-pogrebnyakov opened this issue Nov 16, 2017 · 2 comments
Closed

Fields list in selects #17

grechkin-pogrebnyakov opened this issue Nov 16, 2017 · 2 comments

Comments

@grechkin-pogrebnyakov
Copy link

grechkin-pogrebnyakov commented Nov 16, 2017

Now it generates:

// One is used to retrieve one result. It returns gorm.ErrRecordNotFound
// if nothing was fetched
func (qs PaymentQuerySet) One(ret *Payment) error {
 return qs.db.First(ret).Error
}

If would be awesome if it was this like:

// One is used to retrieve one result. It returns gorm.ErrRecordNotFound
// if nothing was fetched
func (qs PaymentQuerySet) One(ret *Payment, fields ...paymentDBSchemaField) error {
 if (len(fields) != 0) {
  qs = qs.w(qs.db.Select(fields...))
 }
 return qs.db.First(ret).Error
}
@ghost
Copy link

ghost commented Oct 17, 2019

I think that pull request #58 handles this.

@derElektrobesen
Copy link
Collaborator

Fixed in #58

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

No branches or pull requests

3 participants