Consider reading the Medium Story first.
This package provides examples on how to run PostgreSQL units tests against a real database with every tests running in a separate SQL transaction. You can find the tests in this package.
The PostgreSQL database is started using the https://github.com/adrianbrad/psqldocker package.
The sql connections are opened in an isolated SQL transaction using the https://github.com/adrianbrad/psqltest package.