Connecting to Postgres DB in Go

go mod init postgres-playground
  • host — the address where our postgres database is running
  • port — the port the database server is running on. 5432 is the default port of postgrest
  • user — the database user we will be connecting with
  • dbName — the name of our database

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store