From 646136fb44d2669a20172bb9c62d88ac33d501af Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Fri, 11 Jul 2014 08:26:01 -0500 Subject: [PATCH] Rename *Rows.NextRow to *Rows.Next Conform closer to database/sql --- conn.go | 4 ++-- conn_pool_test.go | 2 +- conn_test.go | 24 ++++++++++++------------ stdlib/sql.go | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/conn.go b/conn.go index a8220a9a..780566a5 100644 --- a/conn.go +++ b/conn.go @@ -406,7 +406,7 @@ func (r *Row) Scan(dest ...interface{}) (err error) { return rows.Err() } - if !rows.NextRow() { + if !rows.Next() { if rows.Err() == nil { return ErrNoRows } else { @@ -507,7 +507,7 @@ func (rows *Rows) Fatal(err error) { rows.Close() } -func (rows *Rows) NextRow() bool { +func (rows *Rows) Next() bool { if rows.closed { return false } diff --git a/conn_pool_test.go b/conn_pool_test.go index e1842455..0954798e 100644 --- a/conn_pool_test.go +++ b/conn_pool_test.go @@ -410,7 +410,7 @@ func TestConnPoolQuery(t *testing.T) { t.Fatalf("Unexpected connection pool stats: %v", stats) } - for rows.NextRow() { + for rows.Next() { var n int32 rows.Scan(&n) sum += n diff --git a/conn_test.go b/conn_test.go index 4f803f7d..c1957a64 100644 --- a/conn_test.go +++ b/conn_test.go @@ -316,7 +316,7 @@ func TestConnQuery(t *testing.T) { } defer rows.Close() - for rows.NextRow() { + for rows.Next() { var n int32 rows.Scan(&n) sum += n @@ -345,7 +345,7 @@ func ensureConnValid(t *testing.T, conn *pgx.Conn) { } defer rows.Close() - for rows.NextRow() { + for rows.Next() { var n int32 rows.Scan(&n) sum += n @@ -386,9 +386,9 @@ func TestConnQueryCloseEarly(t *testing.T) { t.Fatalf("conn.Query failed: ", err) } - ok := rows.NextRow() + ok := rows.Next() if !ok { - t.Fatal("rows.NextRow terminated early") + t.Fatal("rows.Next terminated early") } var n int32 @@ -417,7 +417,7 @@ func TestConnQueryReadWrongTypeError(t *testing.T) { rowsRead := 0 - for rows.NextRow() { + for rows.Next() { var t time.Time rows.Scan(&t) rowsRead++ @@ -449,7 +449,7 @@ func TestConnQueryReadTooManyValues(t *testing.T) { rowsRead := 0 - for rows.NextRow() { + for rows.Next() { var n, m int32 rows.Scan(&n, &m) rowsRead++ @@ -477,9 +477,9 @@ func TestConnQueryUnpreparedScanner(t *testing.T) { t.Fatalf("conn.Query failed: ", err) } - ok := rows.NextRow() + ok := rows.Next() if !ok { - t.Fatal("rows.NextRow terminated early") + t.Fatal("rows.Next terminated early") } var n, m pgx.NullInt64 @@ -517,9 +517,9 @@ func TestConnQueryPreparedScanner(t *testing.T) { t.Fatalf("conn.Query failed: ", err) } - ok := rows.NextRow() + ok := rows.Next() if !ok { - t.Fatal("rows.NextRow terminated early") + t.Fatal("rows.Next terminated early") } var n, m pgx.NullInt64 @@ -557,9 +557,9 @@ func TestConnQueryUnpreparedEncoder(t *testing.T) { t.Fatalf("conn.Query failed: ", err) } - ok := rows.NextRow() + ok := rows.Next() if !ok { - t.Fatal("rows.NextRow terminated early") + t.Fatal("rows.Next terminated early") } var m pgx.NullInt64 diff --git a/stdlib/sql.go b/stdlib/sql.go index f588d4c4..1993db06 100644 --- a/stdlib/sql.go +++ b/stdlib/sql.go @@ -182,7 +182,7 @@ func (r *Rows) Close() error { } func (r *Rows) Next(dest []driver.Value) error { - more := r.rows.NextRow() + more := r.rows.Next() if !more { if r.rows.Err() == nil { return io.EOF