From 6161728ff9ce457b0dd20c782698d6faf5e7833d Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 20 Apr 2019 11:47:16 -0500 Subject: [PATCH] Prepare takes context Also remove PrepareEx. It's primary usage was for context. Supplying parameter OIDs is unnecessary when you can type cast in the query SQL. If it does become necessary or desirable to add options back it can be added in a backwards compatible way by adding a varargs as last argument. --- hstore_array_test.go | 2 +- record_test.go | 2 +- testutil/testutil.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hstore_array_test.go b/hstore_array_test.go index 03dc2ff1..849b5835 100644 --- a/hstore_array_test.go +++ b/hstore_array_test.go @@ -70,7 +70,7 @@ func TestHstoreArrayTranscode(t *testing.T) { Status: pgtype.Present, } - ps, err := conn.Prepare("test", "select $1::hstore[]") + ps, err := conn.Prepare(context.Background(), "test", "select $1::hstore[]") if err != nil { t.Fatal(err) } diff --git a/record_test.go b/record_test.go index 44b0e9d8..a4fc1e5d 100644 --- a/record_test.go +++ b/record_test.go @@ -85,7 +85,7 @@ func TestRecordTranscode(t *testing.T) { for i, tt := range tests { psName := fmt.Sprintf("test%d", i) - ps, err := conn.Prepare(psName, tt.sql) + ps, err := conn.Prepare(context.Background(), psName, tt.sql) if err != nil { t.Fatal(err) } diff --git a/testutil/testutil.go b/testutil/testutil.go index 3711381c..0d653394 100644 --- a/testutil/testutil.go +++ b/testutil/testutil.go @@ -107,7 +107,7 @@ func TestPgxSuccessfulTranscodeEqFunc(t testing.TB, pgTypeName string, values [] conn := MustConnectPgx(t) defer MustCloseContext(t, conn) - _, err := conn.Prepare("test", fmt.Sprintf("select $1::%s", pgTypeName)) + _, err := conn.Prepare(context.Background(), "test", fmt.Sprintf("select $1::%s", pgTypeName)) if err != nil { t.Fatal(err) } @@ -225,7 +225,7 @@ func TestPgxSuccessfulNormalizeEqFunc(t testing.TB, tests []NormalizeTest, eqFun for i, tt := range tests { for _, fc := range formats { psName := fmt.Sprintf("test%d", i) - ps, err := conn.Prepare(psName, tt.SQL) + ps, err := conn.Prepare(context.Background(), psName, tt.SQL) if err != nil { t.Fatal(err) }