MCPcopy
hub / github.com/jackc/pgx / TestLargeObjectsSimpleProtocol

Function TestLargeObjectsSimpleProtocol

large_objects_test.go:37–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestLargeObjectsSimpleProtocol(t *testing.T) {
38 // We use a very short limit to test chunking logic.
39 pgx.SetMaxLargeObjectMessageLength(t, 2)
40
41 ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
42 defer cancel()
43
44 config, err := pgx.ParseConfig(os.Getenv("PGX_TEST_DATABASE"))
45 if err != nil {
46 t.Fatal(err)
47 }
48
49 config.DefaultQueryExecMode = pgx.QueryExecModeSimpleProtocol
50
51 conn, err := pgx.ConnectConfig(ctx, config)
52 if err != nil {
53 t.Fatal(err)
54 }
55
56 pgxtest.SkipCockroachDB(t, conn, "Server does support large objects")
57
58 tx, err := conn.Begin(ctx)
59 if err != nil {
60 t.Fatal(err)
61 }
62
63 testLargeObjects(t, ctx, tx)
64}
65
66func testLargeObjects(t *testing.T, ctx context.Context, tx pgx.Tx) {
67 lo := tx.LargeObjects()

Callers

nothing calls this directly

Calls 3

SkipCockroachDBFunction · 0.92
testLargeObjectsFunction · 0.85
BeginMethod · 0.65

Tested by

no test coverage detected