In this chapter, we started our journey by introducing PostgreSQL. We saw how to run PostgreSQL in Docker, and then listed out a few basic SQL queries for CRUD operations. We learned how to add new users and roles in PostgreSQL. We then discussed pq, a PostgreSQL driver package for Go, with an example.
We designed a URL-shortening service using the Base62 algorithm. We leveraged pq and gorilla/mux for implementing that service.
PostgreSQL also allows JSON storage (JSONStore) from version 9.2 onward. It allows developers to insert and retrieve JSON documents in a database. It combines the power of both relational and non-relational databases with JSONStore.
We also introduced GORM, a well-known ORM for Go. Using an ORM, database operations can be easily managed. GORM provides a few useful functions—such as AutoMigrate (creating a table if one doesn't exist)...