Skip to content

Commit 5534fa9

Browse files
committed
Improve Rows docs
fixes #2373
1 parent a295d68 commit 5534fa9

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

rows.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,19 @@ type Rows interface {
4141
// when there was an error executing the query.
4242
FieldDescriptions() []pgconn.FieldDescription
4343

44-
// Next prepares the next row for reading. It returns true if there is another
45-
// row and false if no more rows are available or a fatal error has occurred.
46-
// It automatically closes rows when all rows are read.
44+
// Next prepares the next row for reading. It returns true if there is another row and false if no more rows are
45+
// available or a fatal error has occurred. It automatically closes rows upon returning false (whether due to all rows
46+
// having been read or due to an error).
4747
//
48-
// Callers should check rows.Err() after rows.Next() returns false to detect
49-
// whether result-set reading ended prematurely due to an error. See
50-
// Conn.Query for details.
48+
// Callers should check rows.Err() after rows.Next() returns false to detect whether result-set reading ended
49+
// prematurely due to an error. See Conn.Query for details.
5150
//
52-
// For simpler error handling, consider using the higher-level pgx v5
53-
// CollectRows() and ForEachRow() helpers instead.
51+
// For simpler error handling, consider using the higher-level pgx v5 CollectRows() and ForEachRow() helpers instead.
5452
Next() bool
5553

56-
// Scan reads the values from the current row into dest values positionally.
57-
// dest can include pointers to core types, values implementing the Scanner
58-
// interface, and nil. nil will skip the value entirely. It is an error to
59-
// call Scan without first calling Next() and checking that it returned true.
54+
// Scan reads the values from the current row into dest values positionally. dest can include pointers to core types,
55+
// values implementing the Scanner interface, and nil. nil will skip the value entirely. It is an error to call Scan
56+
// without first calling Next() and checking that it returned true. Rows is automatically closed upon error.
6057
Scan(dest ...any) error
6158

6259
// Values returns the decoded row values. As with Scan(), it is an error to

0 commit comments

Comments
 (0)