Closed siwik75 closed 2 years ago
Hello! Thank you for providing all that information.
I see that your struct field doesn't have the db
tag, without a tag scany translates the field name to snake case, so RequestId
-> request_id
, but in the SQL select you have requestid
column.
Please check this documentation section for details: https://pkg.go.dev/github.com/georgysavva/scany@v0.2.8/dbscan#hdr-Mapping_struct_field_to_database_column
Hello! Why is this issue still Open ?
@lamari I didn't close it because the author of the issue hasn't replied yet. But I think you are right and we can close it due to inactivity. Since it seems there is no problem on the scany side.
Similar to the example given in readme, I tried to tailor it to my case, using postgres (local db) and pgx module v4
Here I tried the two versions of select with 4 or just 2 columns which would fit into the FanOutStatus struct
ERROR when calling the method is QueryRow failed: scany: column: 'requestid': no corresponding field found, or it's unexported in pgrds.FanOutStatus
from debugging, found that issue triggers at dbscan.go
line 294
rs(RowScanner) is populated with all the columns but not the map, which is empty.