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

Commits on Jan 14, 2023

  1. Add support to stream factory

    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>
    ruyadorno committed Jan 14, 2023
    Configuration menu
    Copy the full SHA
    83988bc View commit details
    Browse the repository at this point in the history