2
0

Remove AfterClose() and Conn() from Tx and Rows

This commit is contained in:
Jack Christensen
2017-05-06 10:00:49 -05:00
parent 8322171bd8
commit 2a49569747
5 changed files with 26 additions and 99 deletions
+2 -37
View File
@@ -1,9 +1,9 @@
package pgx_test
import (
"github.com/jackc/pgx"
"testing"
"time"
"github.com/jackc/pgx"
)
func TestTransactionSuccessfulCommit(t *testing.T) {
@@ -226,41 +226,6 @@ func TestBeginExReadOnly(t *testing.T) {
}
}
func TestTxAfterClose(t *testing.T) {
t.Parallel()
conn := mustConnect(t, *defaultConnConfig)
defer closeConn(t, conn)
tx, err := conn.Begin()
if err != nil {
t.Fatal(err)
}
var zeroTime, t1, t2 time.Time
tx.AfterClose(func(tx *pgx.Tx) {
t1 = time.Now()
})
tx.AfterClose(func(tx *pgx.Tx) {
t2 = time.Now()
})
tx.Rollback()
if t1 == zeroTime {
t.Error("First Tx.AfterClose callback not called")
}
if t2 == zeroTime {
t.Error("Second Tx.AfterClose callback not called")
}
if t1.Before(t2) {
t.Errorf("AfterClose callbacks called out of order: %v, %v", t1, t2)
}
}
func TestTxStatus(t *testing.T) {
t.Parallel()