package pgx_test import ( "context" "testing" "github.com/jackc/pgx/v5" "github.com/stretchr/testify/require" ) type testRowScanner struct { name string age int32 } func (rs *testRowScanner) ScanRow(rows pgx.Rows) error { return rows.Scan(&rs.name, &rs.age) } func TestRowScanner(t *testing.T) { t.Parallel() defaultConnTestRunner.RunTest(context.Background(), t, func(ctx context.Context, t testing.TB, conn *pgx.Conn) { var s testRowScanner err := conn.QueryRow(ctx, "select 'Adam' as name, 72 as height").Scan(&s) require.NoError(t, err) require.Equal(t, "Adam", s.name) require.Equal(t, int32(72), s.age) }) }