Original post

Sometimes getting a database connection up and running can be a bit fiddly, we’ve all been there, and it can help to have an example to work from. This post aims to show you the complete basics of creating a database connection, forming a query to run and populating a struct with our resulting data.
To do with we use the database/sql interface and load in the pq driver/library to actually do the work for us.