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

ListWhere() silently fails and returns empty objects #13

Open
sgabe opened this issue Aug 16, 2020 · 1 comment · May be fixed by #14
Open

ListWhere() silently fails and returns empty objects #13

sgabe opened this issue Aug 16, 2020 · 1 comment · May be fixed by #14

Comments

@sgabe
Copy link

sgabe commented Aug 16, 2020

It seems that ListWhere() is unable to convert a []Recorder back to its real type and returns an empty base object. Further investigation showed that there is a contradiction within the function on how to handle keys.

The below snippet shows that the includeKeys parameter of Column() is false hence columns that are marked as keys will be omitted from the returned list.

var cols []string = d.Columns(false)

However, later the withKeys parameter of FieldReferences() is true hence fields marked as keys will be included in the returned list.

dest := s.FieldReferences(true)

This will currently result in a mismatch between the number of columns and throw an ERROR: sql: expected 19 destination arguments in Scan, not 20 message. Unfortunately, errors returned by rows.Scan(dest...) are ignored hence the function will silently fail and return an empty base object.

sgabe added a commit to sgabe/structable that referenced this issue Aug 16, 2020
Fixes Masterminds#13 by including columns that are marked as keys and returning
possible Scan errors.
@sgabe sgabe linked a pull request Aug 16, 2020 that will close this issue
@AlmogBaku
Copy link

is this repo maintained? why isn't it merged?

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

Successfully merging a pull request may close this issue.

2 participants