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

Function testJSONStringPointer

values_test.go:138–152  ·  view source on GitHub ↗
(t testing.TB, conn *pgx.Conn, typename string)

Source from the content-addressed store, hash-verified

136}
137
138func testJSONStringPointer(t testing.TB, conn *pgx.Conn, typename string) {
139 input := `{"key": "value"}`
140 expectedOutput := map[string]string{"key": "value"}
141 var output map[string]string
142 err := conn.QueryRow(context.Background(), "select $1::"+typename, &input).Scan(&output)
143 if err != nil {
144 t.Errorf("%s: QueryRow Scan failed: %v", typename, err)
145 return
146 }
147
148 if !reflect.DeepEqual(expectedOutput, output) {
149 t.Errorf("%s: Did not transcode map[string]string successfully: %v is not %v", typename, expectedOutput, output)
150 return
151 }
152}
153
154func testJSONSingleLevelStringMap(t *testing.T, conn *pgx.Conn, typename string) {
155 input := map[string]string{"key": "value"}

Callers 1

Calls 2

ScanMethod · 0.65
QueryRowMethod · 0.65

Tested by

no test coverage detected