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)
| 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. |
| 59 | func 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. |