Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get fields from query stream #3015

Open
ZeRego opened this issue Jun 19, 2023 · 1 comment
Open

Get fields from query stream #3015

ZeRego opened this issue Jun 19, 2023 · 1 comment

Comments

@ZeRego
Copy link

ZeRego commented Jun 19, 2023

Copy of this issue from the legacy repository brianc/node-pg-query-stream#51

When using pg-query-stream is there a way to get the field description at the beginning or end of the stream?

@brianc
Copy link
Owner

brianc commented Sep 1, 2023

You can do this:

const query = new QueryStream('SELECT * FROM SOMETHING')
const stream = client.query(query)
client.connection.once('rowDescription', (fields) => {
  
})

The stream itself doesn't emit the row description event, but the connection (kinda lower level thing inside the client) does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants