Rows is the result set returned from *Conn.Query. Rows must be closed before the *Conn can be used again. Rows are closed by explicitly calling Close(), calling Next() until it returns false, or when a fatal error occurs. Once a Rows is closed the only methods that may be called are Close(), Err(), and CommandTag(). Rows is an interface instead of a struct to allow tests to mock Query. However, adding a method to an interface is technically a breaking change. Because of this the Rows interface is partially excluded from semantic version requirements. Methods will not be removed or changed, but new methods may be added.
Close closes the rows, making the connection ready for use again. It is safe to call Close after rows is already closed.
Close()
Err returns any error that occurred while reading.
Next prepares the next row for reading. It returns true if there is another row and false if no more rows are available. It automatically closes rows when all rows are read.
Scan reads the values from the current row into dest values positionally. dest can include pointers to core types, values implementing the Scanner interface, and nil. nil will skip the value entirely.
RawValues returns the unparsed bytes of the row values. The returned [][]byte is only valid until the next Next call or the Rows is closed. However, the underlying byte data is safe to retain a reference to and mutate.
Row is a convenience wrapper over Rows that is returned by QueryRow. Row is an interface instead of a struct to allow tests to mock QueryRow. However, adding a method to an interface is technically a breaking change. Because of this the Row interface is partially excluded from semantic version requirements. Methods will not be removed or changed, but new methods may be added.
Scan works the same as Rows. with the following exceptions. If no rows were found it returns ErrNoRows. If multiple rows are returned it ignores all but the first.
ScanRow decodes raw row data into dest. It can be used to scan rows read from the lower level pgconn interface. connInfo - OID to Go type mapping. fieldDescriptions - OID and format of values values - the raw data as returned from the PostgreSQL server dest - the destination that values will be decoded into
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.