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

Function TestJSONAndJSONBTranscodeExtendedOnly

values_test.go:103–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestJSONAndJSONBTranscodeExtendedOnly(t *testing.T) {
104 t.Parallel()
105
106 conn := mustConnectString(t, os.Getenv("PGX_TEST_DATABASE"))
107 defer closeConn(t, conn)
108
109 for _, typename := range []string{"json", "jsonb"} {
110 if _, ok := conn.TypeMap().TypeForName(typename); !ok {
111 continue // No JSON/JSONB type -- must be running against old PostgreSQL
112 }
113 testJSONSingleLevelStringMap(t, conn, typename)
114 testJSONNestedMap(t, conn, typename)
115 testJSONStringArray(t, conn, typename)
116 testJSONInt64Array(t, conn, typename)
117 testJSONInt16ArrayFailureDueToOverflow(t, conn, typename)
118 testJSONStruct(t, conn, typename)
119 }
120}
121
122func testJSONString(t testing.TB, conn *pgx.Conn, typename string) {
123 input := `{"key": "value"}`

Callers

nothing calls this directly

Calls 10

mustConnectStringFunction · 0.85
testJSONNestedMapFunction · 0.85
testJSONStringArrayFunction · 0.85
testJSONInt64ArrayFunction · 0.85
testJSONStructFunction · 0.85
TypeForNameMethod · 0.80
TypeMapMethod · 0.80
closeConnFunction · 0.70

Tested by

no test coverage detected