TIL there is a proposal in Go to allow database/sql queries to extract values into a struct, similar to how encoding/json or encoding/xml do value unmarshaling. Promising.

https://github.com/golang/go/issues/61637

#golang

proposal: database/sql: add methods to scan an entire row into one value · Issue #61637 · golang/go

Edited: struct field names are matched to columns case-sensitively. Edited: untouched storage is ignored rather than zeroed. I propose adding the method ScanRow(dest any) error to the Row and Rows ...

GitHub
@danirod oh interesting. I wouldn’t mind seeing the stdlib take on the kind of features found in sqlx.