How To Install golang-gopkg-pg.v5-dev on Ubuntu 18.04

In this tutorial we learn how to install golang-gopkg-pg.v5-dev on Ubuntu 18.04. golang-gopkg-pg.v5-dev is PostgreSQL client and ORM for Golang

Introduction

In this tutorial we learn how to install golang-gopkg-pg.v5-dev on Ubuntu 18.04.

What is golang-gopkg-pg.v5-dev

golang-gopkg-pg.v5-dev is:

Go-pg is a convenient PostgreSQL client and ORM for Golang with the following features:

  • Basic types: integers, floats, string, bool, time.Time. sql.NullBool, sql.NullString, sql.NullInt64, sql.NullFloat64 and pg.NullTime
  • sql.Scanner and sql/driver.Valuer interfaces
  • Structs, maps and arrays are marshalled as JSON by default
  • PostgreSQL multidimensional Arrays using array tag and Array wrapper
  • Hstore using hstore tag and Hstore wrapper
  • All struct fields are nullable by default and zero values (empty string, 0, zero time) are marshalled as SQL NULL. ``sql:",notnull"` is used to reverse this behaviour
  • Transactions
  • Prepared statements
  • Notifications using LISTEN and NOTIFY
  • Copying data using COPY FROM and COPY TO
  • Timeouts
  • Automatic connection pooling
  • Queries retries on network errors
  • Working with models using ORM and SQL
  • Scanning variables using ORM and SQL
  • SelectOrInsert using on-conflict
  • INSERT … ON CONFLICT DO UPDATE using ORM
  • Common table expressions using WITH and WrapWith
  • CountEstimate using EXPLAIN to get estimated number of matching rows
  • HasOne, BelongsTo, HasMany and ManyToMany-
  • Creating tables from structs
  • Migrations
  • Sharding

There are three methods to install golang-gopkg-pg.v5-dev on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install golang-gopkg-pg.v5-dev Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install golang-gopkg-pg.v5-dev using apt-get by running the following command:

sudo apt-get -y install golang-gopkg-pg.v5-dev

Install golang-gopkg-pg.v5-dev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install golang-gopkg-pg.v5-dev using apt by running the following command:

sudo apt -y install golang-gopkg-pg.v5-dev

Install golang-gopkg-pg.v5-dev Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install golang-gopkg-pg.v5-dev using aptitude by running the following command:

sudo aptitude -y install golang-gopkg-pg.v5-dev

How To Uninstall golang-gopkg-pg.v5-dev on Ubuntu 18.04

To uninstall only the golang-gopkg-pg.v5-dev package we can use the following command:

sudo apt-get remove golang-gopkg-pg.v5-dev

Uninstall golang-gopkg-pg.v5-dev And Its Dependencies

To uninstall golang-gopkg-pg.v5-dev and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove golang-gopkg-pg.v5-dev

Remove golang-gopkg-pg.v5-dev Configurations and Data

To remove golang-gopkg-pg.v5-dev configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge golang-gopkg-pg.v5-dev

Remove golang-gopkg-pg.v5-dev configuration, data, and all of its dependencies

We can use the following command to remove golang-gopkg-pg.v5-dev configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge golang-gopkg-pg.v5-dev

References

Summary

In this tutorial we learn how to install golang-gopkg-pg.v5-dev package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.