Remove tests against github.com/lib/pq

query-exec-mode
Jack Christensen 2021-08-26 21:08:18 -05:00
parent e95ebc02d9
commit 37044f47f5
6 changed files with 8 additions and 40 deletions

View File

@ -5,4 +5,4 @@
pgtype implements Go types for over 70 PostgreSQL types. pgtype is the type system underlying the
https://github.com/jackc/pgx PostgreSQL driver. These types support the binary format for enhanced performance with pgx.
They also support the database/sql `Scan` and `Value` interfaces and can be used with https://github.com/lib/pq.
They also support the database/sql `Scan` and `Value` interfaces.

View File

@ -19,10 +19,7 @@ func TestCIDTranscode(t *testing.T) {
}
testutil.TestPgxSuccessfulTranscodeEqFunc(t, pgTypeName, values, eqFunc)
for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} {
testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, driverName, pgTypeName, values, eqFunc)
}
testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, "github.com/jackc/pgx/stdlib", pgTypeName, values, eqFunc)
}
func TestCIDSet(t *testing.T) {

View File

@ -10,7 +10,6 @@ import (
"github.com/jackc/pgtype"
"github.com/jackc/pgx/v4"
_ "github.com/jackc/pgx/v4/stdlib"
_ "github.com/lib/pq"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

View File

@ -11,14 +11,11 @@ import (
"github.com/jackc/pgtype"
"github.com/jackc/pgx/v4"
_ "github.com/jackc/pgx/v4/stdlib"
_ "github.com/lib/pq"
)
func MustConnectDatabaseSQL(t testing.TB, driverName string) *sql.DB {
var sqlDriverName string
switch driverName {
case "github.com/lib/pq":
sqlDriverName = "postgres"
case "github.com/jackc/pgx/stdlib":
sqlDriverName = "pgx"
default:
@ -98,9 +95,7 @@ func TestSuccessfulTranscode(t testing.TB, pgTypeName string, values []interface
func TestSuccessfulTranscodeEqFunc(t testing.TB, pgTypeName string, values []interface{}, eqFunc func(a, b interface{}) bool) {
TestPgxSuccessfulTranscodeEqFunc(t, pgTypeName, values, eqFunc)
for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} {
TestDatabaseSQLSuccessfulTranscodeEqFunc(t, driverName, pgTypeName, values, eqFunc)
}
TestDatabaseSQLSuccessfulTranscodeEqFunc(t, "github.com/jackc/pgx/stdlib", pgTypeName, values, eqFunc)
}
func TestPgxSuccessfulTranscodeEqFunc(t testing.TB, pgTypeName string, values []interface{}, eqFunc func(a, b interface{}) bool) {
@ -205,9 +200,7 @@ func TestSuccessfulNormalize(t testing.TB, tests []NormalizeTest) {
func TestSuccessfulNormalizeEqFunc(t testing.TB, tests []NormalizeTest, eqFunc func(a, b interface{}) bool) {
TestPgxSuccessfulNormalizeEqFunc(t, tests, eqFunc)
for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} {
TestDatabaseSQLSuccessfulNormalizeEqFunc(t, driverName, tests, eqFunc)
}
TestDatabaseSQLSuccessfulNormalizeEqFunc(t, "github.com/jackc/pgx/stdlib", tests, eqFunc)
}
func TestPgxSuccessfulNormalizeEqFunc(t testing.TB, tests []NormalizeTest, eqFunc func(a, b interface{}) bool) {
@ -287,16 +280,12 @@ func TestDatabaseSQLSuccessfulNormalizeEqFunc(t testing.TB, driverName string, t
func TestGoZeroToNullConversion(t testing.TB, pgTypeName string, zero interface{}) {
TestPgxGoZeroToNullConversion(t, pgTypeName, zero)
for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} {
TestDatabaseSQLGoZeroToNullConversion(t, driverName, pgTypeName, zero)
}
TestDatabaseSQLGoZeroToNullConversion(t, "github.com/jackc/pgx/stdlib", pgTypeName, zero)
}
func TestNullToGoZeroConversion(t testing.TB, pgTypeName string, zero interface{}) {
TestPgxNullToGoZeroConversion(t, pgTypeName, zero)
for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} {
TestDatabaseSQLNullToGoZeroConversion(t, driverName, pgTypeName, zero)
}
TestDatabaseSQLNullToGoZeroConversion(t, "github.com/jackc/pgx/stdlib", pgTypeName, zero)
}
func TestPgxGoZeroToNullConversion(t testing.TB, pgTypeName string, zero interface{}) {

View File

@ -14,25 +14,11 @@ func TestTimeTranscode(t *testing.T) {
&pgtype.Time{Microseconds: 0, Status: pgtype.Present},
&pgtype.Time{Microseconds: 1, Status: pgtype.Present},
&pgtype.Time{Microseconds: 86399999999, Status: pgtype.Present},
&pgtype.Time{Microseconds: 86400000000, Status: pgtype.Present},
&pgtype.Time{Status: pgtype.Null},
})
}
// Test for transcoding 24:00:00 separately as github.com/lib/pq doesn't seem to support it.
func TestTimeTranscode24HH(t *testing.T) {
pgTypeName := "time"
values := []interface{}{
&pgtype.Time{Microseconds: 86400000000, Status: pgtype.Present},
}
eqFunc := func(a, b interface{}) bool {
return reflect.DeepEqual(a, b)
}
testutil.TestPgxSuccessfulTranscodeEqFunc(t, pgTypeName, values, eqFunc)
testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, "github.com/jackc/pgx/stdlib", pgTypeName, values, eqFunc)
}
func TestTimeSet(t *testing.T) {
type _time time.Time

View File

@ -19,10 +19,7 @@ func TestXIDTranscode(t *testing.T) {
}
testutil.TestPgxSuccessfulTranscodeEqFunc(t, pgTypeName, values, eqFunc)
for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} {
testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, driverName, pgTypeName, values, eqFunc)
}
testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, "github.com/jackc/pgx/stdlib", pgTypeName, values, eqFunc)
}
func TestXIDSet(t *testing.T) {