Skip to content

ListWhere() silently fails and returns empty objects #13

@sgabe

Description

@sgabe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions