github.com/jackc/pgx/v5@v5.5.5/pgtype/zeronull/zeronull_test.go (about) 1 package zeronull_test 2 3 import ( 4 "context" 5 "os" 6 "testing" 7 8 "github.com/jackc/pgx/v5" 9 "github.com/jackc/pgx/v5/pgtype/zeronull" 10 "github.com/jackc/pgx/v5/pgxtest" 11 "github.com/stretchr/testify/require" 12 ) 13 14 var defaultConnTestRunner pgxtest.ConnTestRunner 15 16 func init() { 17 defaultConnTestRunner = pgxtest.DefaultConnTestRunner() 18 defaultConnTestRunner.CreateConfig = func(ctx context.Context, t testing.TB) *pgx.ConnConfig { 19 config, err := pgx.ParseConfig(os.Getenv("PGX_TEST_DATABASE")) 20 require.NoError(t, err) 21 return config 22 } 23 defaultConnTestRunner.AfterConnect = func(ctx context.Context, t testing.TB, conn *pgx.Conn) { 24 zeronull.Register(conn.TypeMap()) 25 } 26 }