2
0

Rename package pool to pgxpool

pool is too common a name to occupy.
This commit is contained in:
Jack Christensen
2019-06-29 11:37:36 -05:00
parent aff43ee158
commit 08b412740f
14 changed files with 61 additions and 65 deletions
+80
View File
@@ -0,0 +1,80 @@
package pgxpool_test
import (
"context"
"os"
"testing"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/stretchr/testify/require"
)
func TestTxExec(t *testing.T) {
t.Parallel()
pool, err := pgxpool.Connect(context.Background(), os.Getenv("PGX_TEST_DATABASE"))
require.NoError(t, err)
defer pool.Close()
tx, err := pool.Begin(context.Background(), nil)
require.NoError(t, err)
defer tx.Rollback(context.Background())
testExec(t, tx)
}
func TestTxQuery(t *testing.T) {
t.Parallel()
pool, err := pgxpool.Connect(context.Background(), os.Getenv("PGX_TEST_DATABASE"))
require.NoError(t, err)
defer pool.Close()
tx, err := pool.Begin(context.Background(), nil)
require.NoError(t, err)
defer tx.Rollback(context.Background())
testQuery(t, tx)
}
func TestTxQueryRow(t *testing.T) {
t.Parallel()
pool, err := pgxpool.Connect(context.Background(), os.Getenv("PGX_TEST_DATABASE"))
require.NoError(t, err)
defer pool.Close()
tx, err := pool.Begin(context.Background(), nil)
require.NoError(t, err)
defer tx.Rollback(context.Background())
testQueryRow(t, tx)
}
func TestTxSendBatch(t *testing.T) {
t.Parallel()
pool, err := pgxpool.Connect(context.Background(), os.Getenv("PGX_TEST_DATABASE"))
require.NoError(t, err)
defer pool.Close()
tx, err := pool.Begin(context.Background(), nil)
require.NoError(t, err)
defer tx.Rollback(context.Background())
testSendBatch(t, tx)
}
func TestTxCopyFrom(t *testing.T) {
t.Parallel()
pool, err := pgxpool.Connect(context.Background(), os.Getenv("PGX_TEST_DATABASE"))
require.NoError(t, err)
defer pool.Close()
tx, err := pool.Begin(context.Background(), nil)
require.NoError(t, err)
defer tx.Rollback(context.Background())
testCopyFrom(t, tx)
}