Describe the feature

The addition of documentation related to

  • cleanup of GORM
  • The proper method of closing a connection (or pool), etc, with the removal of .Close(),
  • why .Close() was removed

likely on https://gorm.io/docs/generic_interface.html

Motivation

I am currently writing the code to cleanup and gracefully shut down my server. In the process I would like to close the connections to my database so that everything is handled neatly. I believe that I have my solution, which is just to use .Close() on the db from .DB(), however, given that appears to be the default response, I am unsure as to why .Close() was removed because of connection pooling misuse.

It is obvious that I am not the only one who is confused at how to close the connection now, as such, it would be nice to have documentation describing the above added to the site.

Related Issues

https://github.com/go-gorm/gorm/issues/3535 https://stackoverflow.com/questions/63816057/how-do-i-close-database-instance-in-gorm-1-20-0

Comment From: jinzhu

In 99.99% cases, users don't need to close the connection, even in your case. The Close method caused lots of misusage, causing more trouble than it's convenience.

Comment From: awidiyadew

I found this doc on how to close the connection with the interface sql.DB. https://gorm.io/docs/generic_interface.html