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

Function TestJSONAndJSONBTranscode

values_test.go:85–101  ·  view source on GitHub ↗

TODO - move these tests to pgtype

(t *testing.T)

Source from the content-addressed store, hash-verified

83// TODO - move these tests to pgtype
84
85func TestJSONAndJSONBTranscode(t *testing.T) {
86 t.Parallel()
87
88 ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
89 defer cancel()
90
91 pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *pgx.Conn) {
92 for _, typename := range []string{"json", "jsonb"} {
93 if _, ok := conn.TypeMap().TypeForName(typename); !ok {
94 continue // No JSON/JSONB type -- must be running against old PostgreSQL
95 }
96
97 testJSONString(t, conn, typename)
98 testJSONStringPointer(t, conn, typename)
99 }
100 })
101}
102
103func TestJSONAndJSONBTranscodeExtendedOnly(t *testing.T) {
104 t.Parallel()

Callers

nothing calls this directly

Calls 5

RunWithQueryExecModesFunction · 0.92
testJSONStringFunction · 0.85
testJSONStringPointerFunction · 0.85
TypeForNameMethod · 0.80
TypeMapMethod · 0.80

Tested by

no test coverage detected