A package for working with a database
This section will develop a Go package for working with a given database schema stored on a Postgres database, with the end goal of demonstrating how to develop, store, and use a package. When interacting with specific schemas and tables in your application, you usually create separate packages with all the database-related functions—this also applies to NoSQL databases.
Go offers a generic package (https://golang.org/pkg/database/sql/) for working with databases. However, each database requires a specific package that acts as the driver and allows Go to connect and work with this specific database.
The steps for creating the desired Go package are as follows:
- Downloading the necessary external Go packages for working with PostgreSQL.
- Creating package files.
- Developing the required functions.
- Using the Go package for developing utilities.
- Using CI/CD tools for automation (this is optional). ...