Data Persistency
Our API is in good shape, but we have a huge problem: we are not persisting the data, which is a big deal in most APIs. The whole point of most APIs is to store and retrieve data, so we need to fix this. In this chapter, we are going to learn how to store data in real applications. We will see concepts such as accessing the database with the Go sql package, the repository pattern, and how to use a query builder. Also, we are going to implement the storage layer and persist the data in a database as we explore the following concepts:
- How to create and access a database
- What is the repository pattern?
- Exploring the sql package
- How to use a query builder
- Adding persistence to our API