Manabie Tech Blog

Sharing the humble technical knowledge we’re using to improve education

Snapshot test your Postgresql in Golang pgx driver

If your unit-test understand SQL syntax, you can cover many behaviors of your code without the need of starting a real DB. Want to understand Postgresql syntax? just simply import Postgresql parser to your program, https://github.com/pganalyze/pg_query_go helps you to do that. How about using a containerized DB? Sometimes, the repository layer doesn’t have much logic (maybe concat some WHERE conditions), only propagate the SQL statement to DB. Testing with a simple containerized DB is a good option where you can: Read more →