RunWithQueryExecModes runs a f in a new test for each element of modes with a new connection created using connector. If modes is nil all pgx.QueryExecModes are tested.
(ctx context.Context, t *testing.T, ctr ConnTestRunner, modes []pgx.QueryExecMode, f func(ctx context.Context, t testing.TB, conn *pgx.Conn))
| 82 | // RunWithQueryExecModes runs a f in a new test for each element of modes with a new connection created using connector. |
| 83 | // If modes is nil all pgx.QueryExecModes are tested. |
| 84 | func RunWithQueryExecModes(ctx context.Context, t *testing.T, ctr ConnTestRunner, modes []pgx.QueryExecMode, f func(ctx context.Context, t testing.TB, conn *pgx.Conn)) { |
| 85 | if modes == nil { |
| 86 | modes = AllQueryExecModes |
| 87 | } |
| 88 | |
| 89 | for _, mode := range modes { |
| 90 | ctrWithMode := ctr |
| 91 | ctrWithMode.CreateConfig = func(ctx context.Context, t testing.TB) *pgx.ConnConfig { |
| 92 | config := ctr.CreateConfig(ctx, t) |
| 93 | config.DefaultQueryExecMode = mode |
| 94 | return config |
| 95 | } |
| 96 | |
| 97 | t.Run(mode.String(), |
| 98 | func(t *testing.T) { |
| 99 | ctrWithMode.RunTest(ctx, t, f) |
| 100 | }, |
| 101 | ) |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | type ValueRoundTripTest struct { |
| 106 | Param any |