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

Function TestConnRaw

stdlib/sql_test.go:769–782  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

767}
768
769func TestConnRaw(t *testing.T) {
770 testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) {
771 conn, err := db.Conn(context.Background())
772 require.NoError(t, err)
773
774 var n int
775 err = conn.Raw(func(driverConn any) error {
776 conn := driverConn.(*stdlib.Conn).Conn()
777 return conn.QueryRow(context.Background(), "select 42").Scan(&n)
778 })
779 require.NoError(t, err)
780 assert.EqualValues(t, 42, n)
781 })
782}
783
784func TestConnPingContextSuccess(t *testing.T) {
785 testWithAllQueryExecModes(t, func(t *testing.T, db *sql.DB) {

Callers

nothing calls this directly

Calls 4

ConnMethod · 0.65
ScanMethod · 0.65
QueryRowMethod · 0.65

Tested by

no test coverage detected