MCPcopy
hub / github.com/go-gorm/gorm / ScanRows

Method ScanRows

finisher_api.go:592–609  ·  view source on GitHub ↗
(rows *sql.Rows, dest interface{})

Source from the content-addressed store, hash-verified

590}
591
592func (db *DB) ScanRows(rows *sql.Rows, dest interface{}) error {
593 tx := db.getInstance()
594 if err := tx.Statement.Parse(dest); !errors.Is(err, schema.ErrUnsupportedDataType) {
595 tx.AddError(err)
596 }
597 tx.Statement.Dest = dest
598 tx.Statement.ReflectValue = reflect.ValueOf(dest)
599 for tx.Statement.ReflectValue.Kind() == reflect.Ptr {
600 elem := tx.Statement.ReflectValue.Elem()
601 if !elem.IsValid() {
602 elem = reflect.New(tx.Statement.ReflectValue.Type().Elem())
603 tx.Statement.ReflectValue.Set(elem)
604 }
605 tx.Statement.ReflectValue = elem
606 }
607 Scan(rows, tx, ScanInitialized)
608 return tx.Error
609}
610
611// Connection uses a db connection to execute an arbitrary number of commands in fc. When finished, the connection is
612// returned to the connection pool.

Callers 4

ScanMethod · 0.80
TestScanRowsFunction · 0.80
TestGenericsRowFunction · 0.80

Calls 7

getInstanceMethod · 0.95
ScanFunction · 0.85
ParseMethod · 0.80
AddErrorMethod · 0.65
NewMethod · 0.65
TypeMethod · 0.65
SetMethod · 0.65

Tested by 3

TestScanRowsFunction · 0.64
TestGenericsRowFunction · 0.64