In my last article Query vs Execute vs Prepare, I tried to give you a peek into how Golang tries to juggle between a normal query or a prepared statement based on how you choose to invoke a query or execute or prepare. We emphasized on one of the key aspects which is the network calls you would incur in choosing one over the other so that you can make an informed decision while working with the databse/sql package.

In this article, I’ll try to shed some light on the how the database connection is used by this package.


Golang with SQL

Go comes with a database/sql library to talk to any relational database. In a bid to abstract some of the low level complexities in connecting to the db and managing the connection pool, the exposed APIs seem to do a bit more than you actually expect them to do. This eventually leads to some confusion around how to use these APIs.

Hence, I’ve tried to analyze the behavior of the major APIs that one must be aware of before using them.

I did my experiments with my go application running on a virtual box (ubuntu) and a mysql server on…

Filtering in REST is the ability to filter the results returned by a Read API.

In a restful architecture, we define CRUD (Create, Read, Update, Delete) APIs on a collection. A collection in this context is a list of a domain entity (think a collection — movies, for an entity — movie, for IMDB).

In this article, we’ll explore complex filtering using an example and also discuss a library that I’ve created to implement the same.

What is the need to filter the results?

Consider the example of a movie database MyIMDB which exposes an API to find movies: …

alok sinha

Undivided attention to Divided (or Distributed) systems. Strive to be more informative rather than writing perfect articles.

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