Go

Status Updater App

My father-in-law has very limited vision due to Macular Degeneration. As the disease progressed he became unable to use email to contact us from his assisted living facility. We needed to provide a way for him to contact us to let us know he is OK in the morning and afternoon or to call him if needed. For serious issues he has a button on his wrist to alert the local staff.

Testing PostgreSQL Databases With Go

While setting up a Go project for database access using the PostgreSQL database I was looking for an efficient way to quickly unit test different database access functions without a lot of extra setup or time for each test. Also to make the tests more useful it helps if the actual Postgres drivers and database is used.

For this purpose I found an interesting Go package called txdb that’s described as a Single transaction based sql.Driver for Go. It allows to run a series of SQL commands in a test that get automatically rolled back after the test is complete. This allows the next test to start with pristine database conditions to keep the test independent. In practice I found this very useful and it helped me more quickly develop a correct database schema and database access code.