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

Add support to stream factory #2898

Merged
merged 1 commit into from Jan 23, 2023

Conversation

ruyadorno
Copy link
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 ruyadorno@google.com

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 <ruyadorno@google.com>
@brianc
Copy link
Owner

brianc commented Jan 23, 2023

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.

@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
Copy link
Contributor Author

awesome to hear @brianc! thank you so much 😄

ruyadorno added a commit to ruyadorno/DefinitelyTyped that referenced this pull request May 17, 2023
ruyadorno added a commit to ruyadorno/DefinitelyTyped that referenced this pull request May 17, 2023
ruyadorno added a commit to ruyadorno/DefinitelyTyped that referenced this pull request May 17, 2023
typescript-bot pushed a commit to DefinitelyTyped/DefinitelyTyped that referenced this pull request May 23, 2023
Desplandis pushed a commit to Desplandis/DefinitelyTyped that referenced this pull request Jul 3, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants