You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
you cannot open database once, when the server starts, and close on exit, instead it would need to be opened and closed on every operation - this is likely to be inefficient.
API doesn't differentiate between opening and creating database - this is error prone and it is better to manage in the application, where the application can potentially warn user about the missing database instead of creating a new one.
While the current withDB API needs to be preserved both for backwards compatibility and for simple testing, what is missing for production use is open/close/create APIs.
Happy to contribute if it's acceptable.
The text was updated successfully, but these errors were encountered:
The way I use it in production opens the database only once, and keeps the handle throughout the lifecycle of the application. The entire application is wrapped inside withDB or withDBCF. It prevents the user from shooting himself in the foot by leaving the lifecycle management of the database handle to the bracket. There's a Haskell language extension that can be used to prevent a database handle from escaping its context, called LinearTypes, but I haven't gotten around to experimenting with it.
What you seem to want to do with your change is to expose the underlying open/close functions to be used directly. Is that correct?
Currently there are two problems with the API:
While the current withDB API needs to be preserved both for backwards compatibility and for simple testing, what is missing for production use is open/close/create APIs.
Happy to contribute if it's acceptable.
The text was updated successfully, but these errors were encountered: