prisma / quaint

SQL Query AST and Visitor for Rust
Apache License 2.0
583 stars 61 forks source link

Expose maximum connection lifetimes #267

Closed Sytten closed 3 years ago

Sytten commented 3 years ago

This adds the max_lifetime on the builder and exposes max_connection_lifetime and max_idle_connection_lifetime via the URL parser. Needed for serverless environments where it is not a good idea to never close connections, see https://github.com/prisma/prisma/issues/5977

I did try to respect the coding style of each parser but there is a refactoring job to be done down there to make them uniform, it's a bit of a mess.

Sytten commented 3 years ago

Let me know if you want tests for that parsing somewhere

pimeys commented 3 years ago

These are overwritten in https://github.com/prisma/prisma-engines/blob/master/query-engine/connectors/sql-query-connector/src/database/mssql.rs#L34-L35 et.al.

Sytten commented 3 years ago

Yes will need to change that too.

Sytten commented 3 years ago

@pimeys @janpio I added some getters on the builder since I found this was the most straight forward way to not override the parameter in the engines. The url is parsed multiple times so it is quite confusing really (connection info in the engine, connection info in the builder and new method of the builder), but the builder getter wont lie.

pimeys commented 3 years ago

Had a discussion with @Sytten and we decided that the defaults we set in the engines could be defined (and documented) in Quaint instead, removing the need for the getters.