Go applications frequently need to make use of long-term storage. This is usually in the form of relational and non-relational databases, as well as key-value stores and more. When working with these storage applications, it helps to wrap your operations in an interface. The recipes in this chapter will examine various storage interfaces, consider parallel access with things such as connection pools, and look at general tips for integrating a new library, which is often the case when using a new storage technology.
In this chapter, the following recipes will be covered:
- Using the database/sql package with MySQL
- Executing a database transaction interface
- Connection pooling, rate limiting, and timeouts for SQL
- Working with Redis
- Using NoSQL with MongoDB
- Creating storage interfaces for data portability