vapor / postgres-nio

šŸ˜ Non-blocking, event-driven Swift client for PostgreSQL.
https://api.vapor.codes/postgresnio/documentation/postgresnio/
MIT License
327 stars 75 forks source link

Passing connection options for database #320

Closed jefflewis closed 10 months ago

jefflewis commented 1 year ago

Is your feature request related to a problem? Please describe. There is not a current way to specify additional query params for the database connection (e.g. options=--cluster%3some-app-123) for servers that might require that (as cockroach DB does for shared database clusters)

Describe the solution you'd like One of the configuration and connection parameters should be an options hash that allows for various string key/values to be applied as an options value for the query params.

Describe alternatives you've considered This is a base connection level feature. Being able to pass the options is supported in other database adapters (e.g. ruby's sequel gem: https://github.com/jeremyevans/sequel/blob/41d2adf7d89d73fb895cb7eae174b9dc1cec4c7e/lib/sequel/database/connecting.rb#L38)

Additional context I was attempting to use Vapor/fluent to connect to a cockroachdb cluster to test it out and discovered this issue

fabianfett commented 1 year ago

We will need to add this to PostgresFrontendMessage.Startup and pipe the additional options [(String, String)] through.

fabianfett commented 1 year ago

@jefflewis Can you please check if #361 fixes your needs?

jefflewis commented 1 year ago

Awesome!

fabianfett commented 1 year ago

@jefflewis Have you validated the fix already? Or should I understand your comment more like: "Awesome! [I'll try this soon]"? If it is the latter do you need any help validating the fix?

fabianfett commented 10 months ago

@jefflewis gentle ping.

jefflewis commented 10 months ago

Oh yes! I had verified with the PR, but forgot to close when it was released. Thanks so much for this!

fabianfett commented 10 months ago

@jefflewis I havenā€™t merged this yet. Waited for your ok. Sounds like I can merge and close this.