In my years working with Golang, I came to the conclusion that working with SQL is not a well-solved problem yet. The libraries that we have available are just not easy to use and there are too many ways of shooting your own foot.

To illustrate that I will try to describe in this article all these problems in detail and then briefly present the solution that I came up with for solving these issues: a library that I wrote called KSQL.

In the next sections we'll discuss three widely adopted libraries in the Golang ecosystem:

  • The standard library: database/sql
  • A wrapper of the standard library that adds some cool features like struct scan: sqlx
  • A specialized driver for Postgres that is faster than the alternatives and that can be used together with database/sql or sqlx: pgx
continue reading on betterprogramming.pub

⚠️ This post links to an external website. ⚠️