GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add support to stream factory by ruyadorno · Pull Request #2898 · brianc/node-postgres

Conversation

@ruyadorno

@ruyadorno ruyadorno commented Jan 14, 2023

Copy link
Copy Markdown
Contributor

This changeset enables declaring the stream config value as a factory method. Providing a much more flexible control of the socket connection.

Defining a custom stream config value allows the postgres driver to support a larger variety of environments/setups such as proxy servers and secure socket connections that are used by cloud providers such as GCP.

Currently, usage of the stream config value is only viable for single connections given that it's only possible to define a single socket stream instance per new Client/Pool instance. By adding support to a factory function, it becomes possible to enable usage of custom socket streams for connection pools.

For reference, see the mysql2 driver for MySQL (linked below) for prior art example of this pattern.

Refs: https://github.com/sidorares/node-mysql2/blob/ba15fe25703665e516ab0a23af8d828d1473b8c3/lib/connection.js#L63-L65
Refs: https://cloud.google.com/sql/docs/postgres/connect-overview
Signed-off-by: Ruy Adorno [email protected]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ruyadorno
Add support to stream factory
83988bc
This changeset enables declaring the `stream` config value as a factory
method. Providing a much more flexible control of the socket connection.

Defining a custom `stream` config value allows the postgres driver to
support a larger variety of environments/setups such as proxy servers
and secure socket connections that are used by cloud providers such as
GCP.

Currently, usage of the `stream` config value is only viable for single
connections given that it's only possible to define a single socket
stream instance per new Client/Pool instance. By adding support to a
factory function, it becomes possible to enable usage of custom socket
streams for connection pools.

For reference, see the `mysql2` driver for MySQL (linked below) for
prior art example of this pattern.

Refs: https://github.com/sidorares/node-mysql2/blob/ba15fe25703665e516ab0a23af8d828d1473b8c3/lib/connection.js#L63-L65
Refs: https://cloud.google.com/sql/docs/postgres/connect-overview
Signed-off-by: Ruy Adorno <[email protected]>
@brianc

brianc commented Jan 23, 2023

Copy link
Copy Markdown
Owner

Hey sorry for missing this! Been on the road traveling for my dad's 70th birthday. I'll get to this & a couple other PRs merged up here & do a release with these cool features & fixes.

ruyadorno, LukeSchlangen, jackwotherspoon, gajus, and preetjdp reacted with heart emoji
All reactions
  • ❤️ 5 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brianc
brianc merged commit f82f39c into brianc:master Jan 23, 2023
@ruyadorno
ruyadorno deleted the add-stream-factory-method branch January 23, 2023 18:05
@ruyadorno

ruyadorno commented Jan 23, 2023

Copy link
Copy Markdown
Contributor Author

awesome to hear @brianc! thank you so much 😄

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gajus gajus mentioned this pull request Feb 2, 2023
Expose streaming query as (typed) AsyncIterable gajus/slonik#426
Closed
@shleeable shleeable mentioned this pull request Feb 23, 2023
[Dependashlee] Bump pg from 8.5.0 to 8.11.0 (JS) mastodon/mastodon#23815
Closed
ruyadorno added a commit to ruyadorno/DefinitelyTyped that referenced this pull request May 17, 2023
@ruyadorno
Add stream factory method type
88400d5
Refs: brianc/node-postgres#2898
ruyadorno added a commit to ruyadorno/DefinitelyTyped that referenced this pull request May 17, 2023
@ruyadorno
Add stream factory method type
26e8f6c
Refs: brianc/node-postgres#2898
ruyadorno added a commit to ruyadorno/DefinitelyTyped that referenced this pull request May 17, 2023
@ruyadorno
Add stream factory method type
73181a8
Refs: brianc/node-postgres#2898
@ruyadorno ruyadorno mentioned this pull request May 17, 2023
Add stream factory method type in pg DefinitelyTyped/DefinitelyTyped#65527
Merged
8 tasks done
typescript-bot pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request May 23, 2023
@ruyadorno
🤖 Merge PR #65527 Add stream factory method type in pg by @ruyadorno
1c55e1c
Refs: brianc/node-postgres#2898
Desplandis pushed a commit to Desplandis/DefinitelyTyped that referenced this pull request Jul 3, 2023
@ruyadorno @Desplandis
🤖 Merge PR DefinitelyTyped#65527 Add stream factory method type in `p…
dc81552
…g` by @ruyadorno

Refs: brianc/node-postgres#2898
@charmander charmander mentioned this pull request Oct 21, 2025
Unix sockets support on windows #3100
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ruyadorno @brianc
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.