Rename *Rows.NextRow to *Rows.Next

Conform closer to database/sql
scan-io
Jack Christensen 2014-07-11 08:26:01 -05:00
parent d7529600e0
commit 646136fb44
4 changed files with 16 additions and 16 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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