MCPcopy Create free account
hub / github.com/apecloud/myduckserver / ReadRows

Function ReadRows

pgtest/framework.go:59–72  ·  view source on GitHub ↗

ReadRows reads all of the given rows into a slice, then closes the rows. If `normalizeRows` is true, then the rows will be normalized such that all integers are int64, etc.

(rows pgx.Rows, normalizeRows bool)

Source from the content-addressed store, hash-verified

57// ReadRows reads all of the given rows into a slice, then closes the rows. If `normalizeRows` is true, then the rows
58// will be normalized such that all integers are int64, etc.
59func ReadRows(rows pgx.Rows, normalizeRows bool) (readRows []sql.Row, err error) {
60 defer func() {
61 err = errors.Join(err, rows.Err())
62 }()
63 var slice []sql.Row
64 for rows.Next() {
65 row, err := rows.Values()
66 if err != nil {
67 return nil, err
68 }
69 slice = append(slice, row)
70 }
71 return NormalizeRows(rows.FieldDescriptions(), slice, normalizeRows), nil
72}
73
74// NormalizeRows normalizes each value's type within each row, as the tests only want to compare values. Returns a new
75// set of rows in the same order.

Callers 1

runReplicationScriptFunction · 0.92

Calls 3

NormalizeRowsFunction · 0.85
ErrMethod · 0.45
NextMethod · 0.45

Tested by 1

runReplicationScriptFunction · 0.74