MCPcopy
hub / github.com/jackc/pgx / ScanRow

Method ScanRow

rows.go:684–697  ·  view source on GitHub ↗
(rows CollectableRow)

Source from the content-addressed store, hash-verified

682}
683
684func (rs *namedStructRowScanner) ScanRow(rows CollectableRow) error {
685 typ := reflect.TypeOf(rs.ptrToStruct).Elem()
686 fldDescs := rows.FieldDescriptions()
687 namedStructFields, err := lookupNamedStructFields(typ, fldDescs)
688 if err != nil {
689 return err
690 }
691 if !rs.lax && namedStructFields.missingField != "" {
692 return fmt.Errorf("cannot find field %s in returned row", namedStructFields.missingField)
693 }
694 fields := namedStructFields.fields
695 scanTargets := setupStructScanTargets(rs.ptrToStruct, fields)
696 return rows.Scan(scanTargets...)
697}
698
699// Map from namedStructFieldMap -> *namedStructFields
700var namedStructFieldMap sync.Map

Callers

nothing calls this directly

Calls 4

lookupNamedStructFieldsFunction · 0.85
setupStructScanTargetsFunction · 0.85
FieldDescriptionsMethod · 0.65
ScanMethod · 0.65

Tested by

no test coverage detected